wok diff distcc/stuff/distccd @ rev 11690

acpid: update start script
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 18 17:22:04 2012 +0100 (2012-02-18)
parents
children 6cf4a602d2f2
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/distcc/stuff/distccd	Sat Feb 18 17:22:04 2012 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +#!/bin/sh
     1.5 +# /etc/init.d/distccd: Start, stop and restart Distcc daemon on SliTaz, 
     1.6 +# at boot time or with the command line. Daemons options are configured
     1.7 +# with /etc/daemons.conf
     1.8 +#
     1.9 +. /etc/init.d/rc.functions
    1.10 +. /etc/daemons.conf
    1.11 +
    1.12 +get_hosts_list()
    1.13 +{
    1.14 +	if [ -s /etc/distcc/hosts.allow ]; then
    1.15 +		for i in $(cat /etc/distcc/clients.allow); do
    1.16 +			( echo $i | grep -q '^#' ) && continue 
    1.17 +			ALLOW_HOST="$ALLOW_HOST --allow $i"
    1.18 +		done
    1.19 +	else
    1.20 +	       ALLOW_HOST="--allow 127.0.0.1"
    1.21 +	fi
    1.22 +	echo $ALLOW_HOST
    1.23 +}
    1.24 +
    1.25 +NAME=Distccd
    1.26 +DESC="Distcc daemon"
    1.27 +DAEMON="/usr/bin/distccd"
    1.28 +LOGFILE="/var/log/distccd/distccd.log"
    1.29 +PIDFILE="/var/run/distccd/distccd.pid"
    1.30 +ALLOW="$(get_hosts_list)"
    1.31 +JOB=4
    1.32 +OPTIONS="--daemon --verbose -j $JOB $ALLOW --pid-file $PIDFILE --log-file $LOGFILE"
    1.33 +
    1.34 +case "$1" in
    1.35 +  start)
    1.36 +    if [ -f $PIDFILE ] ; then
    1.37 +      echo "$NAME already running."
    1.38 +      exit 1
    1.39 +    fi
    1.40 +    echo -n "Starting $DESC: $NAME... "
    1.41 +    $DAEMON $OPTIONS 
    1.42 +    status
    1.43 +    ;;
    1.44 +  stop)
    1.45 +    if [ ! -f $PIDFILE ] ; then
    1.46 +      echo "$NAME is not running."
    1.47 +      exit 1
    1.48 +    fi
    1.49 +    echo -n "Stopping $DESC: $NAME... "
    1.50 +    kill -15 $(cat $PIDFILE)
    1.51 +    status
    1.52 +    ;;
    1.53 +  restart)
    1.54 +    if [ ! -f $PIDFILE ] ; then
    1.55 +      echo "$NAME is not running."
    1.56 +      exit 1
    1.57 +    fi
    1.58 +    echo -n "Restarting $DESC: $NAME... "
    1.59 +    $DAEMON $OPTIONS -k restart
    1.60 +    status
    1.61 +    ;;
    1.62 +  *)
    1.63 +    echo ""
    1.64 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    1.65 +    echo ""
    1.66 +    exit 1
    1.67 +    ;;
    1.68 +esac
    1.69 +
    1.70 +exit 0