rc.slothd 1.6 KB
Newer Older
1
#!/bin/sh
2
3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2002-2004 University of Utah and the Flux Group.
5
6
# All rights reserved.
#
7
8
9
10
11
12
13
14
15
16
17

USAGE="usage: $0 (start|stop|restart)"

if [ $# -lt 1 ]
then
        echo $USAGE
        exit 1
fi

. /etc/emulab/paths.sh

18
19
20
21
BOSSINFO=`$BINDIR/tmcc bossinfo`
BOSSNAME=`echo $BOSSINFO | awk '{ print $1 }'`

ARGS='-s $BOSSNAME '
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
SEDCMD='sed -e s/^.*=\(.*\)/\1/'

start () {
        for arg in `${BINDIR}/tmcc sdparams`
        do
                case $arg in
                        reg*)
                                ARGS="$ARGS -i `echo $arg | $SEDCMD`"
                                ;;
                        agg*)
                                ARGS="$ARGS -g `echo $arg | $SEDCMD`"
                                ;;
                        load*)
                                ARGS="$ARGS -l `echo $arg | $SEDCMD`"
                                ;;
                        expt*)
                                ARGS="$ARGS -c `echo $arg | $SEDCMD`"
                                ;;
                        ctl*)
                                ARGS="$ARGS -n `echo $arg | $SEDCMD`"
                                ;;
                esac
        done

        ${BINDIR}/slothd ${ARGS}
47
	exit $?
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
}

stop () {
        kill `cat /var/run/slothd.pid`
}

case $1 in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                sleep 1
                start
                ;;
        *)
                echo "Command $1 not valid"
                echo $USAGE
                exit 1
                ;;
esac