3.testbed.sh.in 9.7 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
		#
		# 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`
23 24 25 26
		    if [ $? -ne 0 ]; then
			echo -n " mysqld not running, skipping testbed startup"
			exit 0
		    fi
27 28 29 30 31
		    if [ $disabled -gt 0 ]; then
			echo -n " testbed disabled"
			exit 0
		    fi
		fi
32
		if [ -x @prefix@/sbin/dbboot ]; then
33 34
		        # Delay a moment so that mysqld has started!
		        sleep 2
35 36 37
			echo -n " dbboot"
			@prefix@/sbin/dbboot
		fi
38

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

44 45 46 47
		if [ -x @prefix@/sbin/tmcd.restart  ]; then
			echo -n " tmcd"
			@prefix@/sbin/tmcd.restart
		fi
48

49 50 51 52
		if [ -x @prefix@/sbin/capserver  ]; then
			echo -n " capd"
			@prefix@/sbin/capserver
		fi
53

54 55 56 57
		if [ -x @prefix@/sbin/lastlog_daemon  ]; then
			echo -n " lastlogd"
			@prefix@/sbin/lastlog_daemon
		fi
58

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

64 65 66 67
		if [ -x @prefix@/sbin/stated  ]; then
			echo -n " stated"
			@prefix@/sbin/stated
		fi
Mike Hibler's avatar
Mike Hibler committed
68

69 70 71
		if [ -e @prefix@/etc/inetd.conf  ]; then
			echo -n " testbed-inetd"
			inetd -a @BOSSNODE@ -p /var/run/testbed-inetd.pid @prefix@/etc/inetd.conf
72
		fi
Mike Hibler's avatar
Mike Hibler committed
73

74
		if [ -x @prefix@/sbin/sslxmlrpc_server.py ]; then
75
			echo -n " sslxmlrpc_server"
76 77 78 79 80 81 82 83 84
			if [ -x @prefix@/sbin/daemon_wrapper ]; then
			    @prefix@/sbin/daemon_wrapper -i 30 \
			          -l @prefix@/log/sslxmlrpc_server.log \
			          -p /var/run/sslxmlrpc_server.pid \
			          @prefix@/sbin/sslxmlrpc_server.py -f

			else
			        @prefix@/sbin/sslxmlrpc_server.py 2>/dev/null
			fi
85 86
		fi

87
		# mfrisbeed started with its own script
88

89 90 91 92 93
		if [ -x @prefix@/sbin/reload_daemon  ]; then
			echo -n " reloadd"
			@prefix@/sbin/reload_daemon
		fi

94 95 96 97 98
		if [ -x @prefix@/sbin/checkup_daemon  ]; then
			echo -n " checkupd"
			@prefix@/sbin/checkup_daemon
		fi

99 100 101 102
		if [ -x @prefix@/sbin/mysqld_watchdog  ]; then
			echo -n " mysqld_watchdog"
			@prefix@/sbin/mysqld_watchdog
		fi
103

Mike Hibler's avatar
Mike Hibler committed
104 105 106 107 108
		if [ -x @prefix@/sbin/lease_daemon  ]; then
			echo -n " lease_daemon"
			@prefix@/sbin/lease_daemon
		fi

Leigh B. Stoller's avatar
Leigh B. Stoller committed
109
		if [ -x @prefix@/sbin/protogeni/expire_daemon ]; then
110 111 112 113
			echo -n " expire_daemon"
			@prefix@/sbin/protogeni/expire_daemon
		fi

114 115 116 117 118
		if [ -x @prefix@/sbin/protogeni/sa_daemon ]; then
			echo -n " sa_daemon"
			@prefix@/sbin/protogeni/sa_daemon
		fi

119 120 121 122 123
		if [ -x @prefix@/sbin/protogeni/ch_daemon ]; then
			echo -n " ch_daemon"
			@prefix@/sbin/protogeni/ch_daemon
		fi

124 125 126 127 128
		if [ -x @prefix@/sbin/protogeni/ims_daemon ]; then
			echo -n " ims_daemon"
			@prefix@/sbin/protogeni/ims_daemon
		fi

129 130 131 132 133
		if [ -x @prefix@/sbin/protogeni/igevent_daemon ]; then
			echo -n " igevent_daemon"
			@prefix@/sbin/protogeni/igevent_daemon
		fi

134 135 136 137 138
		if [ -x @prefix@/sbin/checknodes_daemon  ]; then
			echo -n " checknodes_daemon"
			@prefix@/sbin/checknodes_daemon
		fi

139 140 141
		if [ -x @prefix@/sbin/peer_daemon  ]; then
			echo -n " peer_daemon"
			@prefix@/sbin/peer_daemon
142 143
		fi

144 145 146 147 148
		if [ -x @prefix@/sbin/poolmonitor ]; then
			echo -n " poolmonitor"
			@prefix@/sbin/poolmonitor
		fi

149 150 151 152 153
		if [ -x @prefix@/sbin/tcppd ]; then
		        echo -n " tcppd"
			@prefix@/sbin/tcppd &
		fi

154 155 156 157 158
		if [ -x @prefix@/sbin/event_watchdog ]; then
		        echo -n " event_watchdog"
			@prefix@/sbin/event_watchdog
		fi

159 160 161 162
		if [ -x @prefix@/sbin/apt_daemon ]; then
			echo -n " apt_daemon"
			@prefix@/sbin/apt_daemon
		fi
163
		
164 165 166 167 168
		if [ -x @prefix@/sbin/aptexpire_daemon ]; then
			echo -n " aptexpire_daemon"
			@prefix@/sbin/aptexpire_daemon
		fi
		
169 170 171 172 173
		if [ -x @prefix@/sbin/aptevent_daemon ]; then
			echo -n " aptevent_daemon"
			@prefix@/sbin/aptevent_daemon
		fi

174 175 176 177 178
		if [ -x @prefix@/sbin/aptimage_daemon ]; then
			echo -n " aptimage_daemon"
			@prefix@/sbin/aptimage_daemon
		fi

179 180 181 182 183
		if [ -x @prefix@/sbin/apt_scheduler ]; then
			echo -n " apt_scheduler"
			@prefix@/sbin/apt_scheduler
		fi

184 185 186 187 188
		if [ -x @prefix@/sbin/cnetwatch ]; then
			echo -n " cnetwatch"
			@prefix@/sbin/cnetwatch
		fi

189
		if [ $MAINSITE == "1" -a -x @prefix@/sbin/portal_monitor ]; then
190 191 192
			echo -n " portal_monitor"
			@prefix@/sbin/portal_monitor
		fi
193

194 195 196 197 198
		if [ "@POWDER_RFMONITOR@" == "1" -a -x @prefix@/sbin/rfmonitor_daemon ]; then
			echo -n " rfmonitor_daemon"
			@prefix@/sbin/rfmonitor_daemon
		fi

199 200 201 202
		if [ -x @prefix@/sbin/portal_resources ]; then
			echo -n " portal_resources"
			@prefix@/sbin/portal_resources
		fi
203 204 205 206
		#
		# Could trigger experiment creation, so make sure everything
		# else is setup first; i.e., run this last!
		#
207 208
		if [ \( @BOOTINFO_EVENTS@ -eq 0 -o @REPORTBOOT_ENABLED@ -eq 1 \)\
			-a -x @prefix@/sbin/reportboot_daemon ]; then
209 210 211 212 213
			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 \
214
				  @prefix@/sbin/reportboot_daemon -f @REPORTBOOT_FLAGS@
215
			else
216
				@prefix@/sbin/reportboot_daemon @REPORTBOOT_FLAGS@
217 218
			fi
		fi
Leigh B Stoller's avatar
Leigh B Stoller committed
219

220 221
		if [ -n "@ATTENUATOR@" -a -x @prefix@/sbin/attend ]; then
			echo -n " attend"
222
			@prefix@/sbin/attend
223 224
		fi

225
		if /usr/local/bin/mysql monitoring </dev/null >/dev/null 2>&1; then
Gary Wong's avatar
Gary Wong committed
226
			if [ -x @prefix@/sbin/protogeni/mondbd ]; then
227 228 229
			       echo -n " mondbd"
			       @prefix@/sbin/protogeni/mondbd
			fi
Gary Wong's avatar
Gary Wong committed
230
			if [ -x @prefix@/sbin/protogeni/shared-node-listener ]; then
231
			       echo -n " shared-node-listener"
232
			       @prefix@/sbin/protogeni/shared-node-listener
233 234 235
			fi
		fi
		
236 237 238 239 240
		#
		# Could trigger experiment creation, so make sure everything
		# else is setup first; i.e., run this last!
		#
		if [ -x @prefix@/sbin/batch_daemon  ]; then
241 242 243 244 245 246 247 248
			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
249 250
		fi
		;;
251
	stop|faststop|quietstop|onestop|forcestop)
252 253
		if [ -r /var/run/bootinfo.pid ]; then
			kill `cat /var/run/bootinfo.pid`
254 255 256 257
		fi
		if [ -r /var/run/tmcd.pid ]; then
			kill `cat /var/run/tmcd.pid`
		fi
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
		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
288 289 290
		if [ -r /var/run/lease_daemon.pid ]; then
			kill `cat /var/run/lease_daemon.pid`
		fi
291 292 293 294 295 296
		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
297 298 299
		if [ -r /var/run/ch_daemon.pid ]; then
			kill `cat /var/run/ch_daemon.pid`
		fi
300 301 302
		if [ -r /var/run/ims_daemon.pid ]; then
			kill `cat /var/run/ims_daemon.pid`
		fi
303 304 305
		if [ -r /var/run/igevent_daemon.pid ]; then
			kill `cat /var/run/igevent_daemon.pid`
		fi
306 307 308
		if [ -r /var/run/checknodes.pid ]; then
			kill `cat /var/run/checknodes.pid`
		fi
Leigh B Stoller's avatar
Leigh B Stoller committed
309 310 311
		if [ -r /var/run/checknodes_daemon.pid ]; then
			kill `cat /var/run/checknodes_daemon.pid`
		fi
312 313 314
		if [ -r /var/run/batch_daemon_wrapper.pid ]; then
			kill `cat /var/run/batch_daemon_wrapper.pid`
		fi
315 316
		if [ -r /var/run/peer_daemon.pid ]; then
			kill `cat /var/run/peer_daemon.pid`
317
		fi
318 319 320
		if [ -r /var/run/poolmonitor.pid ]; then
			kill `cat /var/run/poolmonitor.pid`
		fi
321 322 323
		if [ -r /var/run/tcppd.pid ]; then
			kill `cat /var/run/tcppd.pid`
		fi
324 325 326
		if [ -r /var/run/event_watchdog.pid ]; then
			kill `cat /var/run/event_watchdog.pid`
		fi
327 328 329
		if [ -r /var/run/apt_daemon.pid ]; then
			kill `cat /var/run/apt_daemon.pid`
		fi
330 331 332
		if [ -r /var/run/aptexpire_daemon.pid ]; then
			kill `cat /var/run/aptexpire_daemon.pid`
		fi
333 334 335
		if [ -r /var/run/apt_scheduler.pid ]; then
			kill `cat /var/run/apt_scheduler.pid`
		fi
336 337 338
		if [ -r /var/run/aptevent_daemon.pid ]; then
			kill `cat /var/run/aptevent_daemon.pid`
		fi
339 340 341
		if [ -r /var/run/aptimage_daemon.pid ]; then
			kill `cat /var/run/aptimage_daemon.pid`
		fi
342 343 344
		if [ -r /var/run/cnetwatch.pid ]; then
			kill `cat /var/run/cnetwatch.pid`
		fi
Leigh B Stoller's avatar
Leigh B Stoller committed
345 346 347
		if [ -r /var/run/apt_checkup.pid ]; then
			kill `cat /var/run/apt_checkup.pid`
		fi
348 349 350
		if [ -r /var/run/portal_monitor.pid ]; then
			kill `cat /var/run/portal_monitor.pid`
		fi
351 352 353
		if [ -r /var/run/rfmonitor_daemon.pid ]; then
			kill `cat /var/run/rfmonitor_daemon.pid`
		fi
354 355 356
		if [ -r /var/run/portal_resources.pid ]; then
			kill `cat /var/run/portal_resources.pid`
		fi
357 358 359
		if [ -r /var/run/attend.pid ]; then
			kill `cat /var/run/attend.pid`
		fi
360 361 362 363 364 365
		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
366 367 368
		if [ -r /var/run/reportboot_daemon.pid ]; then
			kill `cat /var/run/reportboot_daemon.pid`
		fi
369 370 371 372 373 374 375 376 377

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