#! /bin/sh # # Copyright (C) 2002 C. Brandon Forehand # # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # /etc/init.d/distcc # # and symbolic link # # /usr/sbin/rcdistcc # ### BEGIN INIT INFO # Provides: distccd # Required-Start: $network # Required-Stop: $network # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Description: Start the distcc daemon ### END INIT INFO . /etc/rc.status . /etc/rc.config # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} DISTCC=/usr/local/bin/distccd DISTCC_OPTS=--daemon DISTCC_USER=daemon # Shell functions sourced from /etc/rc.status: # rc_check check and set local and overall rc status # rc_status check and set local and overall rc status # rc_status -v ditto but be verbose in local rc status # rc_status -v -r ditto and clear the local rc status # rc_failed set local and overall rc status to failed # rc_reset clear local rc status (overall remains) # rc_exit exit appropriate to overall rc status # First reset status of this service rc_reset case "$1" in start) echo -n "Starting distcc daemon" ## Start daemon with startproc(8). If this fails ## the echo return value is set appropriate. startproc -u $DISTCC_USER $DISTCC $DISTCC_OPTS # Remember status and be verbose rc_status -v ;; stop) echo -n "Shutting down distcc daemon:" ## Stop daemon with killproc(8) and if this fails ## set echo the echo return value. killproc -TERM $DISTCC # Remember status and be verbose rc_status -v ;; restart) ## If first returns OK call the second, if first or ## second command fails, set echo return value. $0 stop && $0 start # Remember status and be quiet rc_status ;; reload) $0 restart # Remember status and be verbose rc_status -v ;; status) echo -n "Checking for service distccd: " checkproc $DISTCC && echo OK || echo No process ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 ;; esac rc_exit