#! /bin/sh
#
# skeleton	example file to build /etc/init.d/ scripts.
#		This file should be used to construct scripts for /etc/init.d.
#
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
#
# Applied for silc by Tamas SZERB <toma@rulez.org>
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/silcd
NAME=silcd
DESC="silc daemon"

#RUNAS="--chuid silc:silc" #read README.Debian !

PID="/var/run/silc-server/silcd.pid" #contained by silcd.conf, check it!
ARGS="-f /etc/silc-server/silcd.conf"

test -x $DAEMON || exit 0

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet --pidfile $PID \
		--exec $DAEMON $RUNAS -- $ARGS \
	|| echo -n "error "
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --quiet --pidfile $PID \
	|| echo -n "error "
	echo "$NAME."
	;;
  reload)
	echo -n "Reloading $DESC: "
	start-stop-daemon --stop --signal 1 --quiet --pidfile $PID \
	|| echo -n "error "
	echo "$NAME."
  ;;
  restart|force-reload)
	echo "Restarting $DESC: "
	echo -n "  "
	$0 stop
	echo -n "  "
	sleep 2
	$0 start
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
