File openstack-novncproxy.init of Package openstack-novncproxy
#!/bin/sh
### BEGIN INIT INFO
# Provides: openstack-novncproxy
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: rabbitmq-server mysql
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Nova novncproxy server
# Description: Nova novncproxy server.
### END INIT INFO
name="novncproxy"
USER="openstack-nova"
GROUP="nobody"
FLAGFILE="/etc/nova/nova.conf"
RUNDIR="/var/run/nova"
LOGFILE="/var/log/nova/$name.log"
WEBROOT="/var/lib/nova/noVNC"
DAEMON="nova-novncproxy"
[ -e "/etc/sysconfig/openstack-$name" ] && . "/etc/sysconfig/openstack-$name"
mkdir -p $RUNDIR
DAEMON_OPTIONS="--flagfile=$FLAGFILE --logfile=$LOGFILE --web=$WEBROOT --daemon"
OPTIONS="${OPTIONS} $DAEMON_OPTIONS"
if [ "x$NOVNC_SSL_ENABLE" = "xyes" ] ; then
SSL_KEY_FILE=`umask 077 >/dev/null ; mktemp /dev/shm/openstack-novnc-key.XXXXXX`
SSL_CRT_FILE=`umask 077 >/dev/null ; mktemp /dev/shm/openstack-novnc-crt.XXXXXX`
chown "$USER" "$SSL_KEY_FILE" "$SSL_CRT_FILE"
OPTIONS="--cert $SSL_CRT_FILE --key $SSL_KEY_FILE ${OPTIONS}"
fi
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v be verbose in local rc status and clear it afterwards
# rc_status -v -r ditto and clear both the local and overall rc status
# rc_status -s display "skipped" and exit with status 3
# rc_status -u display "unused" and exit with status 3
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num>
# rc_reset clear both the local and overall rc status
# rc_exit exit appropriate to overall rc status
# rc_active checks whether a service is activated by symlinks
. /etc/rc.status
FULLNAME="OpenStack::Nova $name server"
case "$1" in
start)
echo -n "Starting $DAEMON"
[ ! -z "$SSL_CRT_FILE" ] && [ ! -z "$SSL_KEY_FILE" ] && ( umask 077 ; cp "$NOVNC_SSL_KEY" "$SSL_KEY_FILE" ; cp "$NOVNC_SSL_CERT" "$SSL_CRT_FILE" )
startproc -u $USER /usr/bin/$DAEMON $OPTIONS </dev/null >/dev/null 2>&1 &
rc_status -v
;;
stop)
echo -n "Shutting down $DAEMON"
killproc python /usr/bin/$DAEMON 2>/dev/null
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
reload)
;;
status)
echo -n "Checking $DAEMON"
/sbin/checkproc python /usr/bin/$DAEMON
rc_status -v
;;
condrestart|try-restart)
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart}"
exit 2
esac
exit $?