#!/bin/sh
### BEGIN INIT INFO
# Provides:          filterproxy
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: startup script for FilterProxy
### END INIT INFO

# Source function library.
DAEMON=/usr/sbin/FilterProxy
NAME=FilterProxy

# Insert your own options here, like "-f /etc/myconfig" to use /etc/myconf instead of
# /etc/filterproxy.conf
OPTIONS="-f /etc/filterproxy.conf"
PORT=8888

[ -x $DAEMON ] || exit 0;

# See how we were called.
case "$1" in
	start)
		echo -n "Starting FilterProxy: "
		start-stop-daemon --start --name $NAME --chuid filterproxy:filterproxy --exec $DAEMON -- -p $PORT $OPTIONS
		echo "done"
		;;
	stop)
		echo -n "Shutting down FilterProxy: "
		start-stop-daemon --stop --oknodo --retry KILL/5 --name $NAME
		echo "done"
		;;
	restart|force-reload)
		$0 stop
		$0 start
		;;
	*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
esac

exit 0
