tomcat在/etc/rc.local中设置了开机自启动,但实际没有自启动的解决办法

解决办法:

在/etc/rc.local中加入source /etc/profile

这个涉及操作系统启动级别,刚启动加载rc.local时并不会加载java的环境变量,需要先source使profile中的java环境变量生效,再启动tomcat才会生效。

rc.local中要先source /etc/profile,否则tomcat可能不会开机启动。

source /etc/rc.local

#tomcat
/usr/local/tomcat/bin/startup.sh > /dev/null 2>&1 &

原文地址:https://www.cnblogs.com/pistachio123/p/15424936.html