Skip to content

Instantly share code, notes, and snippets.

@jihao
Last active August 29, 2015 14:15
Show Gist options
  • Save jihao/88029e1c055bbc0913f8 to your computer and use it in GitHub Desktop.
Save jihao/88029e1c055bbc0913f8 to your computer and use it in GitHub Desktop.
not standard tomcat auto start
Init script contents:
#!/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-7.0.55/bin/startup.sh
}
stop() {
sh /opt/apache-tomcat-7.0.55/bin/shutdown.sh
}
case $1 in
start|stop) $1;;
restart) stop; start;;
*) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac
# Change its permissions and add the correct symlinks automatically:
chmod 755 /etc/init.d/tomcat7
update-rc.d tomcat7 defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment