#添加tomcat服务并设置自启动
vi /etc/init.d/tomcat8.5
#!/bin/sh # # Comments to support chkconfig on RedHat Linux # chkconfig: 2345 64 36 # Version 1.0 #
basedir=/home/program/tomcat-8.5.23 bindir=$basedir/bin
if test -x $bindir/startup.sh then start="$bindir/startup.sh"; else echo "Can't execute $bindir/start.sh from dir $basedir"; exit; fi
if test -x $bindir/shutdown.sh then stop="$bindir/shutdown.sh"; else echo "Can't execute $bindir/shutdown.sh from dir $basedir"; exit; fi
source /etc/profile case "$1" in 'start' ) "$start" start $2 ;; 'stop' ) "$stop" stop $2 ;; 'restart' ) "$stop" stop $2 "$start" start $2 ;; *) echo "Usage: $0 {start|stop|restart}" >&2 ;; esac |
如果你安装了chkconfig可以添加Tomcat的自启动
chkconfig --add tomcat8.5
chkconfig --levels 2345 tomcat8.5