testbed 2.72 KB
Newer Older
1
#!/bin/bash
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
#
3
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
23
#
24 25 26 27 28 29 30 31 32 33 34
### BEGIN INIT INFO
# Provides: pubsubd
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Should-Start: 
# Required-Start: pubsubd
# Required-Stop: 
# Short-Description: Start and stop Emulab daemons
# Description: Start and stop Emulab daemons
### END INIT INFO

35
. /etc/emulab/paths.sh
36 37

#
38
# testbed       Do some testbed stuff,
39
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
40
# description:	On shutdown, it informs the testbed we are rebooting
41
#		and terminates any lingering daemons.
42 43

# Source function library.
44 45 46
if [ -f /etc/rc.d/init.d/functions ]; then
    . /etc/rc.d/init.d/functions
fi
47 48

# Source networking configuration.
49 50 51 52 53
if [ -f /etc/sysconfig/network ]; then
    . /etc/sysconfig/network
elif [ -f /lib/lsb/init-functions ]; then
    . /lib/lsb/init-functions
    NETWORKING=yes
54 55 56
fi

# Check that networking is up.
57
[ "${NETWORKING}" = "no" ] && exit 0
58 59 60 61 62 63

RETVAL=0

# See how we were called.
case "$1" in
  start)
64 65 66
	# This stuff done from rc.local cause I cannot figure
	# out a way to log to the console instead of messages.
	# Note, /var/lock/subsys/testbed will be created at that time.
67 68
	;;
  stop)
69
  	rm -f /var/lock/subsys/testbed /var/emulab/boot/controlif
70 71
	echo "Shutting down testbed daemons (some may fail)..."
	echo -n "  trafgen: "
72
	killproc trafgen
73 74
	echo
	echo -n "  program-agent: "
75
	killproc program-agent
76 77
	echo
	echo -n "  slothd: "
78
	killproc slothd
79 80
	echo
	echo -n "  healthd: "
81
	killproc healthd
82 83
	echo
	echo -n "  watchdog: "
84
	killproc watchdog
85 86
	echo
	echo -n "  evproxy: "
87
	killproc evproxy
88 89
	echo
	echo -n "  linktest: "
90
	killproc linktest
91 92
	echo
	echo -n "  emulab-syncd: "
93
	killproc emulab-syncd
94 95
	echo
	echo -n "  tippty: "
96
	killproc tippty
97
	echo
98 99 100 101 102
        if [ ! -f /var/lock/subsys/tbprepare ]; then
	    echo "Informing the testbed we're rebooting ..."
	    $BINDIR/tmcc state SHUTDOWN
	    RETVAL=$?
	fi
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
	;;
  status)
	echo "Peachy"
	;;
  restart)
	echo "Done"
	;;
  reload)
	echo "Done"
	;;
  *)
	echo "Usage: testbed {start|stop|restart|reload|status}"
	exit 1
esac

exit $RETVAL