This "universal" LSB (Linux Standard Base) start/stop package streamlines authoring of application init scripts for daemon-style servers. It provides a full set of LSB actions (start/stop/restart/status/etc.), and supports running the server as a non-root user, protection against SIGHUP, reliable service restart, service monitoring with auto-restart, and logging of significant events to syslog. It was built originally for Java servers, but can be valuable for many other servers as well.
The logic of a full-featured init script with an extended set of actions and server monitoring for a Java-based server could be about as simple as:
# Set up the PATH export PATH=/usr/java/bin:/usr/local/bin:/usr/bin:/bin # Set up the CLASSPATH export CLASSPATH=/home/server/classes # Run MyServer as user "javaserver" with service monitoring, and # logging of its stdout and stderr to a file. startstop -u javaserver -l /var/log/jsplog -m "$(basename $0)" \ java com.my.MyServer
Man pages converted to HTML by groff: