执行systemctl start/stop/status tomcat
Failed to start tomcat.service: Unit not found.
--------
cd /etc/rc.d/init.d
vim tomcat
#!/bin/bash
# description: Tomcat10 start stop restart
# processname: tomcat10
# chkconfig: 234 20 80
JAVA_HOME=/usr/local/jdk1.8.0_291
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/local/tomcat/apache-tomcat-10.0.8
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
sh $CATALINA_HOME/bin/startup.sh
;;
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0
chmod a+x tomcat
chkconfig --add tomcat
chkconfig --list
systemctl status tomcat