File: disable-host

package info (click to toggle)
dmucs 0.6.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,372 kB
  • ctags: 760
  • sloc: ansic: 5,053; sh: 3,521; cpp: 2,475; makefile: 59; perl: 26
file content (36 lines) | stat: -rwxr-xr-x 1,086 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env sh

DMUCS_DIR=/us/bfsbld/Compilers/distcc

#
# This script undoes what the enable-host script does.  Specifically, it
# kills the dmucs loadavg daemon, and, then sends a "remove host" message
# to the dmucs server (note that a loadavg message from a machine adds
# the host to the dmucs database if it is not already there, but lack of
# periodic load average messages from a host does NOT remove the host from
# the database -- that's why we have to send a "remove host" message.
#
# Then, this script kills the distccd daemons.
#
# Arguments: 1: the name of the machine on which the dmucs server is running.
#

if [ $# -eq 0 ] ; then
    echo "Usage: $0 <server-machine>"
    exit 
fi

server=$1

echo "Stopping the loadavg daemon"
/bin/ps -ef | /bin/grep 'loadavg' | /bin/grep -v grep | /usr/bin/awk '{print $2}' | /usr/bin/xargs /bin/kill
echo "done"

echo "Removing this host from the dmucs server"
$DMUCS_DIR/bin/removehost -s $server
echo "done"

echo "Stopping the distccd daemons"
pidfile=$DMUCS_DIR/pids/`hostname`.pid
/bin/kill -HUP `cat $pidfile`
echo "done"