在digitalocean平台上买了一个服务器,想着自己搭建个前端项目,但是安装完Tomcat9.0之后,把tomcat加入自启的脚本中之后发现报错。
service tomcat does not support chkconfig //务tomcat不支持chkconfig
给各位看下我的脚本
#!/bin/bash??
#?This?is?the?init?script?for?starting?up?the??
#??Jakarta?Tomcat?server??
#??
#?chkconfig:?2345 80 90 ##网上说改这里,改了之后发现还是不行
#?description:?Starts?and?stops?the?Tomcat?daemon.??
#??
#?Source?function?library.??
.?/etc/rc.d/init.d/functions??
#?Get?config.??
.?/etc/sysconfig/network??
#?Check?that?networking?is?up.??
[?"${NETWORKING}"?=?"no"?]?&&?exit?0??
export?JAVA_HOME=/usr/local/java/jdk1.8.0_231?#自己的jdk安装目录
tomcat_home=/home/mytomcat/apache-tomcat-9.0.35??#自己的tomcat安装目录
startup=$tomcat_home/bin/startup.sh??
shutdown=$tomcat_home/bin/shutdown.sh??
start(){??
???echo?-n?"Starting?Tomcat?service:"??
???cd?$tomcat_home??
???$startup??
???echo?"tomcat?is?succeessfully?started?up"??
}??
stop(){??
???echo?-n?"Shutting?down?tomcat:?"??
???cd?$tomcat_home??
???$shutdown??
???echo?"tomcat?is?succeessfully?shut?down."??
}??
status(){??
????numproc=`ps?-ef?|?grep?catalina?|?grep?-v?"grep?catalina"?|?wc?-l`??
????if?[?$numproc?-gt?0?];?then??
???????echo?"Tomcat?is?running..."??
????else??
???????echo?"Tomcat?is?stopped..."??
????fi??
}??
restart(){??
???stop??
???start??
}????
#?See?how?we?were?called.??
case?"$1"?in??
start)??
???start??
???;;??
stop)??
???stop??
???;;??
status)??
???status??
???;;??
restart)??
???restart??
???;;??
*)??
???echo?$"Usage:?$0?{start|stop|status|restart}"??
???exit?1??
esac
以前没用过,也没了解过麻烦各位 提拔提拔
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…