You are looking at historical revision 29910 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)

#! /bin/sh
# -*- shell-script -*-

# 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 [ ! -f "$CONFIG_FILE" ]; then
       echo "Cannot find configuration file. Please create 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