2.portalpsd.sh.in 1.23 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/bin/sh
#
# Start a pubsubd on local boss that accepts SSL connections.
# This is an alternate pubsubd, we cannot send events from other
# clusters into our real pubsubd.
#

# PROVIDE: portalpsd
# REQUIRE: pubsub
# KEYWORD: shutdown

TBROOT="@prefix@"
MAINSITE="@TBMAINSITE@"
PROTOGENI="@PROTOGENI_SUPPORT@"
15 16
CLUSTER_PORTAL="@CLUSTER_PORTAL@"
BOSSNODE="@BOSSNODE@"
17 18 19 20

if [ $PROTOGENI == "0" ]; then
    exit 0
fi
21
if [ $CLUSTER_PORTAL == "" -o $CLUSTER_PORTAL != $BOSSNODE ]; then
22 23 24
    exit 0
fi

25 26 27
. /etc/rc.conf
pubsubd_flags=${pubsubd_flags:-""}

28 29 30 31 32
pubsubd=/usr/local/libexec/pubsubd
pidfile=/var/run/portalpsd.pid
certfile=$TBROOT/etc/emulab.pem
keyfile=$TBROOT/etc/emulab.key
bundlefile=$TBROOT/etc/genica.bundle
33
sslport=@CLUSTER_PUBSUBD_SSLPORT@
34
localport=16507
35 36
pubsubd_flags="$pubsubd_flags -K $keyfile -C $certfile "
pubsubd_flags="$pubsubd_flags -A $bundlefile -S -P $sslport -p $localport"
37 38 39 40

case "$1" in
    start|faststart|quietstart|onestart|forcestart)
	if [ -x $clusterd ]; then
41
	    $pubsubd -e $pidfile $pubsubd_flags
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
	    echo -n "portalpsd";
	fi
	;;
    stop|faststop|quietstop|onestop|forcestop)
	if [ -r $pidfile ]; then
	    kill `cat $pidfile`
	fi
	;;
    *)
	echo ""
	echo "Usage: `basename $0` { start | stop }"
	echo ""
	exit 64
	;;
esac
exit 0