#!/bin/sh
#
# /etc/rc.d/squid: start/stop squid daemon
#

SSD=/sbin/start-stop-daemon
PROG=/usr/sbin/squid
PID=/run/squid.pid
OPTS="-Y"

case $1 in
start)
	install -o squid -g squid -m 0700 -d /run/squid
	$SSD --start --pidfile $PID --exec $PROG -- $OPTS
	;;
stop)
	$SSD --stop --retry 10 --pidfile $PID --signal INT
	;;
shutdown)
	$SSD --stop --retry 60 --pidfile $PID --signal TERM
	;;
restart)
	$0 stop
	$0 start
	;;
reload)
	$SSD --stop --pidfile $PID --signal HUP
	;;
status)
	$SSD --status --pidfile $PID
	case $? in
	0) echo "$PROG is running with pid $(cat $PID)" ;;
	1) echo "$PROG is not running but the pid file $PID exists" ;;
	3) echo "$PROG is not running" ;;
	4) echo "Unable to determine the program status" ;;
	esac
	;;
*)
	echo "usage: $0 [start|stop|shutdown|restart|reload|status]"
	;;
esac

# End of file
