You are looking at historical revision 29914 of this page. It may differ significantly from its current revision.
Here's an example init.d script for Spiffy the webserver, for use on Debian derivatives (created by Mario Domenech Goulart).
This script has also been prepared to play well with the "chkconfig" command on Red Hat derivatives (Fedora, CentOS, ...).
#! /bin/sh # -*- shell-script -*- # Make this script chkconfig compliant, start with runlevel 2345, exit prio 95 (lower) start prio 20 (higher) # chkconfig: 2345 95 20 # description: Control script for the Spiffy CHICKEN webserver # processname: spiffy # This is /etc/init.d/spiffy on Debian systems # It assumes you have a "spiffy.scm" script in /usr/local/libexec and a log directory in /var/log/spiffy # Select which "csi" program to use; defaults to the one in $PATH CSI=csi # Use a longer trace buffer and a larger nursery size (optional) CSI_ARGS="-:s1m -:a200" DATE_FORMAT="+%Y-%m-%d %H:%M:%S" CONFIG_FILE="/usr/local/libexec/spiffy.scm" LOG_DIR="/var/log/spiffy" spiffy_start () { if [ ! -d "$LOG_DIR" ]; then echo "Log directory \"$LOG_DIR\" does not exist." exit 0 fi if [ ! -r "$CONFIG_FILE" ]; then echo "Cannot find or read the configuration file. Please create or check the permissions of the following file: \"$CONFIG_FILE\"." exit 0 fi echo "Starting spiffy..." echo "start: " `date "$DATE_FORMAT"` >> /var/log/spiffy/start-stop.log (cd /var/log/spiffy; ulimit -c unlimited ; $CSI $CSI_ARGS -s /usr/local/libexec/spiffy.scm &) </dev/null &> /var/log/spiffy/init.log } spiffy_stop () { echo "Stopping spiffy..." echo "stop: " `date "$DATE_FORMAT"` >> /var/log/spiffy/start-stop.log pids=`ps ax | grep "[/]usr/local/libexec/spiffy.scm" | awk '{print $1}'` if [ -z "$pids" ] ; then echo "spiffy is not running" else for pid in $pids; do echo "killing " $pid kill $pid done fi } case "$1" in start) spiffy_start ;; stop) spiffy_stop ;; restart) spiffy_stop sleep 1 spiffy_start ;; *) exit 1 esac