#!/bin/sh
# wwwoffle daemon start/stop script.
#
# Copyright Andrew M. Bishop 1997 (was slackware-rc.local)
# Modified  A. Kupries       1998, for usage by the S.u.S.e init system.
#
# Usually this is put in /etc/init.d (at least on machines SYSV R4
# based systems) and linked to /etc/rc[23].d/S18wwwoffle. When this is
# done the wwwoffle server will be started when the machine is started.


PATH=/sbin:/usr/bin:/usr/sbin:/bin
basedir=/usr/local
bindir=/usr/local/bin
export PATH

mode=$1

# Safeguard (relative paths, core dumps..)
cd $basedir

case "$mode" in
  'start')
    # Start deamon

    if [ -x /usr/local/sbin/wwwoffled ]; then
	echo "Starting wwwoffled."

	/usr/local/sbin/wwwoffled -c /var/spool/wwwoffle/wwwoffle.conf
    fi
    ;;

  'stop')
    # Stop deamon
    echo "Shutting down wwwoffled."

    $bindir/wwwoffle -kill
    ;;

  *)
    # usage
    echo "usage: $0 start|stop"
    exit 1
    ;;
esac
