mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Separate novnc from CentOS init scripts
needs PR https://github.com/OpenNebula/one/pull/22
This commit is contained in:
parent
6cecb17f2d
commit
62d0eaa086
96
share/pkgs/CentOS/opennebula-novnc
Executable file
96
share/pkgs/CentOS/opennebula-novnc
Executable file
@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# /etc/rc.d/init.d/opennebula-novnc
|
||||
#
|
||||
# Starts the Novnc Server
|
||||
#
|
||||
# chkconfig: 345 66 34
|
||||
# description: Starts the Sunstone novnc daemon
|
||||
# processname: opennebula-novnc
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: opennebula-novnc
|
||||
# Required-Start: $local_fs $remote_fs oned
|
||||
# Required-Stop: $local_fs $remote_fs oned
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: start and stop opennebula-novnc
|
||||
# Description: start and stop opennebula-novnc
|
||||
### END INIT INFO
|
||||
|
||||
prog="novnc-server"
|
||||
|
||||
SUNSTONE_BIN=/usr/bin/novnc-server
|
||||
LOCKFILE=/var/lock/subsys/${prog}
|
||||
PID_FILE=/var/run/${prog}.pid
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
|
||||
RETVAL=0
|
||||
|
||||
check() {
|
||||
# Check that we're a privileged user
|
||||
[ `id -u` = 0 ] || exit 4
|
||||
|
||||
# Check if sunstone-server is executable
|
||||
test -x $SUNSTONE_BIN || exit 5
|
||||
}
|
||||
|
||||
start() {
|
||||
check
|
||||
|
||||
echo -n $"Starting Opennebula Novnc daemon: "
|
||||
daemon --user oneadmin $SUNSTONE_BIN start
|
||||
RETVAL=$?
|
||||
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && {
|
||||
touch $LOCKFILE
|
||||
echo $(ps -ef|grep novnc-server | awk '{print $2}') > $PID_FILE
|
||||
}
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
check
|
||||
|
||||
echo -n $"Stopping Opennebula Novnc daemon: "
|
||||
daemon --user oneadmin $SUNSTONE_BIN stop
|
||||
RETVAL=$?
|
||||
|
||||
[ $RETVAL -eq 0 ] && success || failure
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE $PID_FILE
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
status)
|
||||
status $prog
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart}"
|
||||
RETVAL=2
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
@ -52,11 +52,13 @@ start() {
|
||||
}
|
||||
|
||||
return $RETVAL
|
||||
service opennebula-novnc start
|
||||
}
|
||||
|
||||
stop() {
|
||||
check
|
||||
|
||||
service opennebula-novnc stop
|
||||
echo -n $"Stopping Sunstone Server daemon: "
|
||||
daemon --user oneadmin $SUNSTONE_BIN stop
|
||||
RETVAL=$?
|
||||
|
Loading…
x
Reference in New Issue
Block a user