本文共 954 字,大约阅读时间需要 3 分钟。
[root@localhost ~]# vi /etc/init.d/tomcat_uc
#!/bin/bash
##
##
. /etc/rc.d/init.d/functions
prog=tomcat_uc
JAVA_HOME=/usr/local/jdkexport JAVA_HOMECATALANA_HOME=/usr/local/webserver/tomcat_ucexport CATALINA_HOMEcase "$1" in
start)echo "Starting Tomcat..."$CATALANA_HOME/bin/startup.sh;;stop)
echo "Stopping Tomcat..."$CATALANA_HOME/bin/shutdown.sh;;restart)
echo "Stopping Tomcat..."$CATALANA_HOME/bin/shutdown.shsleep 2echoecho "Starting Tomcat..."$CATALANA_HOME/bin/startup.sh;;*)
echo "Usage: $prog {start|stop|restart}";;esacexit 0chmod +x /etc/init.d/tomcat_uc
注意centos 7 [root@localhost init.d]# pwd/etc/init.d[root@localhost init.d]# systemctl stop tomcat_uc.service[root@localhost init.d]# systemctl start tomcat_uc.service[root@localhost init.d]#转载于:https://blog.51cto.com/study2008/2084334