wok-next annotate distcc/stuff/distccd @ rev 13890
Up: tazdev (1.9)
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Thu Jan 17 19:37:29 2013 +0100 (2013-01-17) |
parents | 51e71ca42f12 |
children | 0d8a1a3edc72 |
rev | line source |
---|---|
erjo@9469 | 1 #!/bin/sh |
erjo@9469 | 2 # /etc/init.d/distccd: Start, stop and restart Distcc daemon on SliTaz, |
erjo@9469 | 3 # at boot time or with the command line. Daemons options are configured |
erjo@9469 | 4 # with /etc/daemons.conf |
erjo@9469 | 5 # |
erjo@9469 | 6 . /etc/init.d/rc.functions |
erjo@9469 | 7 . /etc/daemons.conf |
erjo@9469 | 8 |
erjo@9469 | 9 get_hosts_list() |
erjo@9469 | 10 { |
erjo@9469 | 11 if [ -s /etc/distcc/hosts.allow ]; then |
erjo@9469 | 12 for i in $(cat /etc/distcc/clients.allow); do |
erjo@9469 | 13 ( echo $i | grep -q '^#' ) && continue |
erjo@9469 | 14 ALLOW_HOST="$ALLOW_HOST --allow $i" |
erjo@9469 | 15 done |
erjo@9469 | 16 else |
erjo@9469 | 17 ALLOW_HOST="--allow 127.0.0.1" |
erjo@9469 | 18 fi |
erjo@9469 | 19 echo $ALLOW_HOST |
erjo@9469 | 20 } |
erjo@9469 | 21 |
erjo@9469 | 22 NAME=Distccd |
erjo@9469 | 23 DESC="Distcc daemon" |
erjo@9469 | 24 DAEMON="/usr/bin/distccd" |
erjo@9469 | 25 LOGFILE="/var/log/distccd/distccd.log" |
erjo@9469 | 26 PIDFILE="/var/run/distccd/distccd.pid" |
erjo@9469 | 27 ALLOW="$(get_hosts_list)" |
erjo@9469 | 28 JOB=4 |
erjo@9469 | 29 OPTIONS="--daemon --verbose -j $JOB $ALLOW --pid-file $PIDFILE --log-file $LOGFILE" |
erjo@9469 | 30 |
erjo@9469 | 31 case "$1" in |
erjo@9469 | 32 start) |
pascal@11694 | 33 if active_pidfile $PIDFILE distccd ; then |
erjo@9469 | 34 echo "$NAME already running." |
erjo@9469 | 35 exit 1 |
erjo@9469 | 36 fi |
erjo@9469 | 37 echo -n "Starting $DESC: $NAME... " |
erjo@9469 | 38 $DAEMON $OPTIONS |
erjo@9469 | 39 status |
erjo@9469 | 40 ;; |
erjo@9469 | 41 stop) |
pascal@11694 | 42 if ! active_pidfile $PIDFILE distccd ; then |
erjo@9469 | 43 echo "$NAME is not running." |
erjo@9469 | 44 exit 1 |
erjo@9469 | 45 fi |
erjo@9469 | 46 echo -n "Stopping $DESC: $NAME... " |
erjo@9469 | 47 kill -15 $(cat $PIDFILE) |
erjo@9469 | 48 status |
erjo@9469 | 49 ;; |
erjo@9469 | 50 restart) |
pascal@11694 | 51 if ! active_pidfile $PIDFILE distccd ; then |
erjo@9469 | 52 echo "$NAME is not running." |
erjo@9469 | 53 exit 1 |
erjo@9469 | 54 fi |
erjo@9469 | 55 echo -n "Restarting $DESC: $NAME... " |
erjo@9469 | 56 $DAEMON $OPTIONS -k restart |
erjo@9469 | 57 status |
erjo@9469 | 58 ;; |
erjo@9469 | 59 *) |
erjo@9469 | 60 echo "" |
erjo@9469 | 61 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
erjo@9469 | 62 echo "" |
erjo@9469 | 63 exit 1 |
erjo@9469 | 64 ;; |
erjo@9469 | 65 esac |
erjo@9469 | 66 |
erjo@9469 | 67 exit 0 |