#! /bin/sh # # thttpd Initscript for thttpd # This scripts should be placed in /etc/init.d. # # Author: Christian Boesgaard # # Version: thttpd 1.0 Dec-2005 pink-thttpd@diku.dk # set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="thttpd" NAME=thttpd DAEMON=/opt/thttpd-2.25b/sbin/$NAME CONFFILE=/etc/thttpd/thttpd.conf PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME ARGUMENTS="-C $CONFFILE -i $PIDFILE" # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 # Gracefully exit if there is no config file if [ ! -f $CONFFILE ]; then exit 1 fi # # Function that starts the daemon/service. # d_start() { start-stop-daemon --start --pidfile $PIDFILE \ --exec $DAEMON -- $ARGUMENTS } # # Function that stops the daemon/service. # d_stop() { start-stop-daemon --stop --pidfile $PIDFILE \ --name $NAME } case "$1" in start) echo -n "Starting $DESC: $NAME" d_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" d_stop echo "." ;; restart|force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart". # echo -n "Restarting $DESC: $NAME" d_stop sleep 1 d_start echo "." ;; *) # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0