1

我在 debian 挤压上运行 tomcat 7.0.42。如何设置 Tomcat 在引导时启动

谢谢您的帮助

4

1 回答 1

0

我认为这是最简单的版本。只需更改 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
于 2013-10-07T20:55:13.950 回答