diff options
Diffstat (limited to 'distcc/distccd')
-rw-r--r-- | distcc/distccd | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/distcc/distccd b/distcc/distccd index aebad6fac..3643e7b9b 100644 --- a/distcc/distccd +++ b/distcc/distccd @@ -1,32 +1,42 @@ -#!/usr/bin/env bash +#!//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 the distcc's README package." - exit 1 -fi +USER="distcc" +GROUP="distcc" +RUNDIR="/var/run/distcc" +PIDFILE="$RUNDIR/distcc.pid" +PROG="/usr/sbin/distccd" +ARGS="--daemon --pid-file $PIDFILE" -DISTCC_USER="${DISTCC_USER:=nobody}" -DISTCC_LOG_LEVEL="${DISTCC_LOG_LEVEL:=notice}" +# Allow overriding variables in separate file (except for PATH) +. /etc/distccd.conf +PATH="/sbin:/usr/sbin:/bin:/usr/bin" case $1 in start) - /usr/sbin/distccd --daemon --user "$DISTCC_USER" --allow "$DISTCC_ALLOW" --log-level "$DISTCC_LOG_LEVEL" + [ -d "$RUNDIR" ] || install -o $USER -g $GROUP -d "$RUNDIR" + start-stop-daemon --start --pidfile $PIDFILE --exec $PROG -- $ARGS ;; stop) - killall -q /usr/sbin/distccd + start-stop-daemon --stop --retry 60 --user $USER --pidfile $PIDFILE --remove-pidfile ;; restart) $0 stop $0 start ;; +status) + start-stop-daemon --status --user $USER --pidfile $PIDFILE + case $? in + 0) echo "$PROG running with pid: $(cat $PIDFILE)" ;; + 1) echo "$PROG not running, stale pidfile: $PIDFILE" ;; + 3) echo "$PROG not running" ;; + 4) echo "Unable to determine program status" ;; + esac + ;; *) - echo "usage: $0 [start|stop|restart]" + echo "usage: $0 [start|stop|status|restart]" ;; esac |