Skip to content

Instantly share code, notes, and snippets.

@jaehoo
Last active August 29, 2015 14:14
Show Gist options
  • Save jaehoo/03714a2984292d45a0dd to your computer and use it in GitHub Desktop.
Save jaehoo/03714a2984292d45a0dd to your computer and use it in GitHub Desktop.
Unix, Startup script for tomcat 7
#!/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
TOMCAT_HOME=/opt/apache-tomcat-7.0.57
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start() {
sudo -u tomcat $TOMCAT_HOME/bin/startup.sh
}
stop() {
sudo -u tomcat $TOMCAT_HOME/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