LSBInitScripts
Simple example
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 /usr/share/tomcat7/bin/startup.sh
}
stop() {
sh /usr/share/tomcat7/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:
See also
- Debian
- log_daemon_msg
- log_progress_msg
- start-stop-daemon
- pidofproc
Favorite site
References
-
Mcchae.egloos.com_-Ubuntu-_Automatic_service_startup_and_shutdown.pdf ↩