mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-26 10:03:37 +03:00
b34232d6c4
(cherry picked from commit 1618ffa4e5ab6d40984daaa4dc8604507397583d)
99 lines
1.6 KiB
Bash
Executable File
99 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# /etc/rc.d/init.d/opennebula-econe
|
|
#
|
|
# Starts the OpenNebula ECONE Server
|
|
#
|
|
# chkconfig: 345 66 34
|
|
# description: Starts the ECONE Server daemon
|
|
# processname: opennebula-econe
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: opennebula-econe
|
|
# 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-econe
|
|
# Description: start and stop opennebula-econe
|
|
### END INIT INFO
|
|
|
|
prog="opennebula-econe"
|
|
|
|
SERVER_BIN=/usr/bin/econe-server
|
|
SERVER_PROGRAM=econe-server.rb
|
|
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 $SERVER_BIN is executable
|
|
test -x $SERVER_BIN || exit 5
|
|
}
|
|
|
|
start() {
|
|
check
|
|
|
|
echo -n $"Starting $prog Server: "
|
|
daemon --user oneadmin $SERVER_BIN start
|
|
RETVAL=$?
|
|
|
|
echo
|
|
[ $RETVAL -eq 0 ] && {
|
|
touch $LOCKFILE
|
|
echo $(ps -ef|grep $SERVER_PROGRAM | awk '{print $2}') > $PID_FILE
|
|
}
|
|
|
|
return $RETVAL
|
|
}
|
|
|
|
stop() {
|
|
|
|
check
|
|
|
|
echo -n $"Stopping $prog Server daemon: "
|
|
daemon --user oneadmin $SERVER_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
|