linux系统在rc.local中设置了两行命令分别用来启动tomcat和一个jar程序,重启之后,
tomcat成功启动,但是启动jar程序的命令没有被执行,上代码:
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In constrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
export JAVA_HOME=/opt/jdk/jdk1.8.0_111
/root/test/apache-tomcat-8.5.6/bin/startup.sh
nohup java -jar /root/test/myjava.jar &
touch /var/lock/subsys/local
是不是nohup命令在启动的时候也需要设置一些环境变量呢,还是说执行jar程序单单一个JAVA_HOME配置不够呢
Linux에서는
으아아아service
과chkconfig
을 함께 사용할 수 있습니다.시작 스크립트를 제공하겠습니다. 콘텐츠를 직접 수정하세요.
이 스크립트는
을 달성할 수 있습니다.service tomcat {start|status|stop|restart....}
chkconfig: 2345 96 14
이 줄도 구현할 수 있습니다$ chkconfig tomcat on