Created
March 22, 2018 14:11
-
-
Save sagrawal31/4e7b49eb67e9280e344d387a04446ad5 to your computer and use it in GitHub Desktop.
init script to auto start Tomcat 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: tomcat7 | |
# 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 /opt/apache-tomcat/bin/startup.sh | |
} | |
stop() { | |
sh /opt/apache-tomcat/bin/shutdown.sh | |
} | |
case $1 in | |
start|stop) $1;; | |
restart) stop; start;; | |
*) echo "Run as $0 <start|stop|restart>"; exit 1;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copied from https://askubuntu.com/questions/223944/how-to-automatically-restart-tomcat7-on-system-reboots