wok-next annotate distcc/stuff/distccd @ rev 20561
Up rrdtool (1.7.0)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Apr 10 00:40:27 2018 +0300 (2018-04-10) |
parents | 0d8a1a3edc72 |
children |
rev | line source |
---|---|
erjo@9469 | 1 #!/bin/sh |
al@19159 | 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 |
al@19159 | 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 |
al@19159 | 23 DESC="$(_ '%s daemon' Distcc)" |
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 |
pascal@16681 | 31 if [ ! -d /var/run/distccd ]; then |
pascal@16681 | 32 mkdir -p /var/run/distccd |
pascal@16681 | 33 chown distccd.distccd /var/run/distccd |
pascal@16681 | 34 fi |
erjo@9469 | 35 case "$1" in |
erjo@9469 | 36 start) |
pascal@11694 | 37 if active_pidfile $PIDFILE distccd ; then |
al@19159 | 38 _ '%s is already running.' $NAME |
erjo@9469 | 39 exit 1 |
erjo@9469 | 40 fi |
al@19159 | 41 action 'Starting %s: %s...' "$DESC" $NAME |
al@19159 | 42 $DAEMON $OPTIONS |
erjo@9469 | 43 status |
erjo@9469 | 44 ;; |
erjo@9469 | 45 stop) |
pascal@11694 | 46 if ! active_pidfile $PIDFILE distccd ; then |
al@19159 | 47 _ '%s is not running.' $NAME |
erjo@9469 | 48 exit 1 |
erjo@9469 | 49 fi |
al@19159 | 50 action 'Stopping %s: %s...' "$DESC" $NAME |
erjo@9469 | 51 kill -15 $(cat $PIDFILE) |
erjo@9469 | 52 status |
erjo@9469 | 53 ;; |
erjo@9469 | 54 restart) |
pascal@11694 | 55 if ! active_pidfile $PIDFILE distccd ; then |
al@19159 | 56 _ '%s is not running.' $NAME |
erjo@9469 | 57 exit 1 |
erjo@9469 | 58 fi |
al@19159 | 59 action 'Restarting %s: %s...' "$DESC" $NAME |
erjo@9469 | 60 $DAEMON $OPTIONS -k restart |
erjo@9469 | 61 status |
erjo@9469 | 62 ;; |
erjo@9469 | 63 *) |
al@19159 | 64 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 65 newline |
erjo@9469 | 66 exit 1 |
erjo@9469 | 67 ;; |
erjo@9469 | 68 esac |
erjo@9469 | 69 |
erjo@9469 | 70 exit 0 |