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

. /etc/rc.conf
if [ -z "$DISTCC_ALLOW" ]; then 
    echo "Please define a range of IPs allowed to connect to this distccd"
    echo "host in DISTCC_ALLOW in /etc/rc.conf. More detailed information"
    echo "can be found in distccd's man page."
    exit -1
fi
DISTCC_USER=${DISTCC_USER:=nobody}

case $1 in
start)
	/usr/bin/distccd --daemon --user $DISTCC_USER --allow $DISTCC_ALLOW
	;;
stop)
	killall -q /usr/bin/distccd
	;;
restart)
	$0 stop
	$0 start
	;;
*)
	echo "usage: $0 [start|stop|restart]"
	;;
esac

# End of file
