我在 debian 挤压上运行 tomcat 7.0.42。如何设置 Tomcat 在引导时启动
谢谢您的帮助
我认为这是最简单的版本。只需更改 Tomcat 路径并将其复制到 /etc/init.d 即可。
#!/bin/bash
### BEGIN INIT INFO
# Provides: Apache Tomcat Server
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start:
# Should-Stop:
# Short-Description: Starts the Tomcat Server.
### END INIT INFO
TOMCAT_HOME=[PATH-TO-TOMCAT-DIR]
case "$1" in
start)
echo "Starting Tomcat Server ..."
$TOMCAT_HOME/bin/startup.sh
;;
stop)
echo "Stopping Tomcat Server ..."
$TOMCAT_HOME/bin/shutdown.sh
;;
*)
echo "Usage: /etc/init.d/tomcat {start|stop}"
exit 1
;;
esac
exit 0