3.testbed.sh.in 8.41 KB
Newer Older
1 2 3 4
#!/bin/sh
#
# Utah Network Testbed local startup
#
5 6

# PROVIDE: testbed
7
# REQUIRE: mysql pubsub mfrisbeed
8 9 10
# BEFORE: apache22
# KEYWORD: shutdown

11 12
MAINSITE="@TBMAINSITE@"

13
case "$1" in
14
	start|faststart|quietstart|onestart|forcestart)
15 16 17 18 19 20 21 22 23 24 25 26 27
		#
		# See if the testbed is "shutdown"; The variable has three values.
	        #  0  - Testbed is enabled.
	        #  1  - Testbed is disabled.
		# -1  - Testbed is coming back online, so start up daemons.
		#
	        if [ -x @prefix@/sbin/setsitevar ]; then
		    disabled=`@prefix@/sbin/setsitevar -c general/testbed_shutdown`
		    if [ $disabled -gt 0 ]; then
			echo -n " testbed disabled"
			exit 0
		    fi
		fi
28
		if [ -x @prefix@/sbin/dbboot ]; then
29 30
		        # Delay a moment so that mysqld has started!
		        sleep 2
31 32 33
			echo -n " dbboot"
			@prefix@/sbin/dbboot
		fi
34

35 36 37 38
		if [ -x @prefix@/sbin/bootinfo.restart  ]; then
			echo -n " bootinfo"
			@prefix@/sbin/bootinfo.restart
		fi
39

40 41 42 43
		if [ -x @prefix@/sbin/tmcd.restart  ]; then
			echo -n " tmcd"
			@prefix@/sbin/tmcd.restart
		fi
44

45 46 47 48
		if [ -x @prefix@/sbin/capserver  ]; then
			echo -n " capd"
			@prefix@/sbin/capserver
		fi
49

50 51 52 53
		if [ -x @prefix@/sbin/lastlog_daemon  ]; then
			echo -n " lastlogd"
			@prefix@/sbin/lastlog_daemon
		fi
54

55 56 57 58
		if [ -x @prefix@/sbin/sdcollectd  ]; then
			echo -n " sdcollectd"
			@prefix@/sbin/sdcollectd
		fi
59

60 61 62 63
		if [ -x @prefix@/sbin/stated  ]; then
			echo -n " stated"
			@prefix@/sbin/stated
		fi
64

65 66 67
		if [ -e @prefix@/etc/inetd.conf  ]; then
			echo -n " testbed-inetd"
			inetd -a @BOSSNODE@ -p /var/run/testbed-inetd.pid @prefix@/etc/inetd.conf
68
		fi
69

70
		if [ -x @prefix@/sbin/sslxmlrpc_server.py ]; then
71
			echo -n " sslxmlrpc_server"
72
			@prefix@/sbin/sslxmlrpc_server.py 2>/dev/null
73 74
		fi

75
		# mfrisbeed started with its own script
76

77 78 79 80 81
		if [ -x @prefix@/sbin/reload_daemon  ]; then
			echo -n " reloadd"
			@prefix@/sbin/reload_daemon
		fi

82 83 84 85 86
		if [ -x @prefix@/sbin/checkup_daemon  ]; then
			echo -n " checkupd"
			@prefix@/sbin/checkup_daemon
		fi

87 88 89 90
		if [ -x @prefix@/sbin/mysqld_watchdog  ]; then
			echo -n " mysqld_watchdog"
			@prefix@/sbin/mysqld_watchdog
		fi
91

Mike Hibler's avatar
Mike Hibler committed
92 93 94 95 96
		if [ -x @prefix@/sbin/lease_daemon  ]; then
			echo -n " lease_daemon"
			@prefix@/sbin/lease_daemon
		fi

Leigh Stoller's avatar
Leigh Stoller committed
97
		if [ -x @prefix@/sbin/protogeni/expire_daemon ]; then
98 99 100 101
			echo -n " expire_daemon"
			@prefix@/sbin/protogeni/expire_daemon
		fi

102 103 104 105 106
		if [ -x @prefix@/sbin/protogeni/sa_daemon ]; then
			echo -n " sa_daemon"
			@prefix@/sbin/protogeni/sa_daemon
		fi

107 108 109 110 111
		if [ -x @prefix@/sbin/protogeni/ch_daemon ]; then
			echo -n " ch_daemon"
			@prefix@/sbin/protogeni/ch_daemon
		fi

112 113 114 115 116
		if [ -x @prefix@/sbin/protogeni/igevent_daemon ]; then
			echo -n " igevent_daemon"
			@prefix@/sbin/protogeni/igevent_daemon
		fi

117 118 119 120 121
		if [ -x @prefix@/sbin/checknodes_daemon  ]; then
			echo -n " checknodes_daemon"
			@prefix@/sbin/checknodes_daemon
		fi

122 123 124 125 126
		if [ -x @prefix@/sbin/portal_daemon  ]; then
			echo -n " portal_daemon"
			@prefix@/sbin/portal_daemon
		fi

127 128 129 130 131
		if [ -x @prefix@/sbin/poolmonitor ]; then
			echo -n " poolmonitor"
			@prefix@/sbin/poolmonitor
		fi

132 133 134 135 136
		if [ -x @prefix@/sbin/tcppd ]; then
		        echo -n " tcppd"
			@prefix@/sbin/tcppd &
		fi

137 138 139 140 141
		if [ -x @prefix@/sbin/event_watchdog ]; then
		        echo -n " event_watchdog"
			@prefix@/sbin/event_watchdog
		fi

142 143 144 145
		if [ -x @prefix@/sbin/apt_daemon ]; then
			echo -n " apt_daemon"
			@prefix@/sbin/apt_daemon
		fi
146
		
147 148 149 150 151
		if [ -x @prefix@/sbin/aptevent_daemon ]; then
			echo -n " aptevent_daemon"
			@prefix@/sbin/aptevent_daemon
		fi

152 153 154 155 156
		if [ -x @prefix@/sbin/apt_scheduler ]; then
			echo -n " apt_scheduler"
			@prefix@/sbin/apt_scheduler
		fi

157 158 159 160 161
		if [ -x @prefix@/sbin/cnetwatch ]; then
			echo -n " cnetwatch"
			@prefix@/sbin/cnetwatch
		fi

162
		if [ $MAINSITE == "1" -a -x @prefix@/sbin/portal_monitor ]; then
163 164 165
			echo -n " portal_monitor"
			@prefix@/sbin/portal_monitor
		fi
166 167 168 169 170

		if [ -x @prefix@/sbin/portal_resources ]; then
			echo -n " portal_resources"
			@prefix@/sbin/portal_resources
		fi
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
		#
		# Could trigger experiment creation, so make sure everything
		# else is setup first; i.e., run this last!
		#
		if [ @BOOTINFO_EVENTS@ -eq 0 -a -x @prefix@/sbin/reportboot_daemon  ]; then
			echo -n " reportboot daemon "
			if [ -x @prefix@/sbin/daemon_wrapper ]; then
			    @prefix@/sbin/daemon_wrapper -i 30 \
			          -l @prefix@/log/reportboot.log \
			          -p /var/run/reportboot_daemon.pid \
				  @prefix@/sbin/reportboot_daemon -f
			else
				@prefix@/sbin/reportboot_daemon
			fi
		fi
Leigh Stoller's avatar
Leigh Stoller committed
186

187 188
		if [ -n "@ATTENUATOR@" -a -x @prefix@/sbin/attend ]; then
			echo -n " attend"
189
			@prefix@/sbin/attend
190 191
		fi

192
		if /usr/local/bin/mysql monitoring </dev/null >/dev/null 2>&1; then
Gary Wong's avatar
Gary Wong committed
193
			if [ -x @prefix@/sbin/protogeni/mondbd ]; then
194 195 196
			       echo -n " mondbd"
			       @prefix@/sbin/protogeni/mondbd
			fi
Gary Wong's avatar
Gary Wong committed
197
			if [ -x @prefix@/sbin/protogeni/shared-node-listener ]; then
198
			       echo -n " shared-node-listener"
199
			       @prefix@/sbin/protogeni/shared-node-listener
200 201 202
			fi
		fi
		
203 204 205 206 207
		#
		# Could trigger experiment creation, so make sure everything
		# else is setup first; i.e., run this last!
		#
		if [ -x @prefix@/sbin/batch_daemon  ]; then
208 209 210 211 212 213 214 215
			echo -n " batchd wrapper "
			if [ -x @prefix@/sbin/daemon_wrapper ]; then
				@prefix@/sbin/daemon_wrapper \
				  -i 30 -l @prefix@/log/batchlog \
				  @prefix@/sbin/batch_daemon -d
			else
				@prefix@/sbin/batch_daemon
			fi
216 217
		fi
		;;
218
	stop|faststop|quietstop|onestop|forcestop)
219 220
		if [ -r /var/run/bootinfo.pid ]; then
			kill `cat /var/run/bootinfo.pid`
221 222 223 224
		fi
		if [ -r /var/run/tmcd.pid ]; then
			kill `cat /var/run/tmcd.pid`
		fi
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
		if [ -r /var/run/capserver.pid ]; then
			kill `cat /var/run/capserver.pid`
		fi
		if [ -r /var/run/lastlog_daemon.pid ]; then
			kill `cat /var/run/lastlog_daemon.pid`
		fi
		if [ -r /var/run/sdcollectd.pid ]; then
			kill `cat /var/run/sdcollectd.pid`
		fi
		if [ -r /var/run/stated.pid ]; then
			kill `cat /var/run/stated.pid`
		fi
		if [ -r /var/run/testbed-inetd.pid ]; then
			kill `cat /var/run/testbed-inetd.pid`
		fi
		if [ -r /var/run/sslxmlrpc_server.pid ]; then
			kill `cat /var/run/sslxmlrpc_server.pid`
		fi
		if [ -r /var/run/reload_daemon.pid ]; then
			kill `cat /var/run/reload_daemon.pid`
		fi
		if [ -r /var/run/checkup_daemon.pid ]; then
			kill `cat /var/run/checkup_daemon.pid`
		fi
		if [ -r /var/run/pool_daemon.pid ]; then
			kill `cat /var/run/pool_daemon.pid`
		fi
		if [ -r /var/run/mysqld_watchdog.pid ]; then
			kill `cat /var/run/mysqld_watchdog.pid`
		fi
255 256 257
		if [ -r /var/run/lease_daemon.pid ]; then
			kill `cat /var/run/lease_daemon.pid`
		fi
258 259 260 261 262 263
		if [ -r /var/run/expire_daemon.pid ]; then
			kill `cat /var/run/expire_daemon.pid`
		fi
		if [ -r /var/run/sa_daemon.pid ]; then
			kill `cat /var/run/sa_daemon.pid`
		fi
264 265 266
		if [ -r /var/run/ch_daemon.pid ]; then
			kill `cat /var/run/ch_daemon.pid`
		fi
267 268 269
		if [ -r /var/run/igevent_daemon.pid ]; then
			kill `cat /var/run/igevent_daemon.pid`
		fi
270 271 272
		if [ -r /var/run/checknodes.pid ]; then
			kill `cat /var/run/checknodes.pid`
		fi
273 274 275
		if [ -r /var/run/checknodes_daemon.pid ]; then
			kill `cat /var/run/checknodes_daemon.pid`
		fi
276 277 278
		if [ -r /var/run/batch_daemon_wrapper.pid ]; then
			kill `cat /var/run/batch_daemon_wrapper.pid`
		fi
279 280 281
		if [ -r /var/run/portal_daemon.pid ]; then
			kill `cat /var/run/portal_daemon.pid`
		fi
282 283 284
		if [ -r /var/run/poolmonitor.pid ]; then
			kill `cat /var/run/poolmonitor.pid`
		fi
285 286 287
		if [ -r /var/run/tcppd.pid ]; then
			kill `cat /var/run/tcppd.pid`
		fi
288 289 290
		if [ -r /var/run/event_watchdog.pid ]; then
			kill `cat /var/run/event_watchdog.pid`
		fi
291 292 293
		if [ -r /var/run/apt_daemon.pid ]; then
			kill `cat /var/run/apt_daemon.pid`
		fi
294 295 296
		if [ -r /var/run/apt_scheduler.pid ]; then
			kill `cat /var/run/apt_scheduler.pid`
		fi
297 298 299
		if [ -r /var/run/aptevent_daemon.pid ]; then
			kill `cat /var/run/aptevent_daemon.pid`
		fi
300 301 302
		if [ -r /var/run/cnetwatch.pid ]; then
			kill `cat /var/run/cnetwatch.pid`
		fi
Leigh Stoller's avatar
Leigh Stoller committed
303 304 305
		if [ -r /var/run/apt_checkup.pid ]; then
			kill `cat /var/run/apt_checkup.pid`
		fi
306 307 308
		if [ -r /var/run/portal_monitor.pid ]; then
			kill `cat /var/run/portal_monitor.pid`
		fi
309 310 311
		if [ -r /var/run/portal_resources.pid ]; then
			kill `cat /var/run/portal_resources.pid`
		fi
312 313 314
		if [ -r /var/run/attend.pid ]; then
			kill `cat /var/run/attend.pid`
		fi
315 316 317 318 319 320
		if [ -r /var/run/mondbd.pid ]; then
			kill `cat /var/run/mondbd.pid`			
		fi
		if [ -r /var/run/shared-node-listener.pid ]; then
			kill `cat /var/run/shared-node-listener.pid`
		fi
321 322 323
		if [ -r /var/run/reportboot_daemon.pid ]; then
			kill `cat /var/run/reportboot_daemon.pid`
		fi
324 325 326 327 328 329 330 331 332

		;;
	*)
		echo ""
		echo "Usage: `basename $0` { start | stop }"
		echo ""
		exit 64
		;;
esac
333
exit 0