Debian Codegraph @

scripts/disable-host

raw
1 #!/usr/bin/env sh
2
3 DMUCS_DIR=/us/bfsbld/Compilers/distcc
4
5 #
6 # This script undoes what the enable-host script does. Specifically, it
7 # kills the dmucs loadavg daemon, and, then sends a "remove host" message
8 # to the dmucs server (note that a loadavg message from a machine adds
9 # the host to the dmucs database if it is not already there, but lack of
10 # periodic load average messages from a host does NOT remove the host from
11 # the database -- that's why we have to send a "remove host" message.
12 #
13 # Then, this script kills the distccd daemons.
14 #
15 # Arguments: 1: the name of the machine on which the dmucs server is running.
16 #
17
18 if [ $# -eq 0 ] ; then
19 echo "Usage: $0 <server-machine>"
20 exit
21 fi
22
23 server=$1
24
25 echo "Stopping the loadavg daemon"
26 /bin/ps -ef | /bin/grep 'loadavg' | /bin/grep -v grep | /usr/bin/awk '{print $2}' | /usr/bin/xargs /bin/kill
27 echo "done"
28
29 echo "Removing this host from the dmucs server"
30 $DMUCS_DIR/bin/removehost -s $server
31 echo "done"
32
33 echo "Stopping the distccd daemons"
34 pidfile=$DMUCS_DIR/pids/`hostname`.pid
35 /bin/kill -HUP `cat $pidfile`
36 echo "done"