#!/bin/sh
#
# for the bwbar package
# Scott Dier <sdier@debian.org>

# delete/comment the following two lines when configured.
echo "/etc/init.d/bwbar isn't configured yet, not starting bwbar."
exit 0

# default settings are suggestions, they may or may not fit your situation
RUNME=/usr/sbin/bwbar
DIR=/var/www
RUNAS=www-data
OPTIONS="eth0 1.5"

[ -x $RUNME ] || exit 0

case "$1" in
	start)
		echo -n "Starting bwbar: "
		start-stop-daemon --start -b -c $RUNAS --exec $RUNME -- --directory=$DIR $OPTIONS
		echo "done."
		;;
	stop)
		echo -n "Stopping bwbar: "
		start-stop-daemon --stop -u $RUNAS --exec $RUNME
		echo "done."
		;;
	restart|force-reload)
		echo -n "Restarting bwbar: "
		start-stop-daemon --stop -u $RUNAS --exec $RUNME
		sleep 1
		start-stop-daemon --start -b -c $RUNAS --exec $RUNME -- --directory=$DIR $OPTIONS
		echo "done."
		;;
	*)
		echo "Usage: /etc/init.d/bwbar {start|stop|restart}"
		exit 1
esac

exit 0
