1 頁 (共 1 頁)

How To Run Tomcat Server At Startup On Ubuntu Server

發表於 : 2018-03-08 09:42:45
yehlu
http://www.linuxandubuntu.com/home/how- ... ntu-server

/etc/init.d/tomcat9

代碼: 選擇全部

#!/bin/bash

### BEGIN INIT INFO
# Provides: tomcat9
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

start() {
sh /tomcat/bin/startup.sh
}

stop() {
sh /tomcat/bin/shutdown.sh
}

case $1 in
start|stop) $1;;
restart) stop; start;;
*) echo "Run as $0 "; exit 1;;

esac

代碼: 選擇全部

$ chmod 755 /etc/init.d/tomcat9
$ update-rc.d tomcat9 defaults