CentOS安装了tomcat之后提示service tomcat does not support chkconfig
在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
以前没用过,也没了解过麻烦各位 提拔提拔
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能是shll的脚本有点问题换了一个就行了。
shll脚本问题,建议更换