mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-09 05:27:20 +09:00
Bug #1289: Improve centos init scripts
This commit is contained in:
1 parent
0471f892ff
commit
f01cfa07eb
3 files changed
+60
-19
No files matched your search
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Starts the OpenNebula daemon
|
||||
#
|
||||
# chkconfig: 345 26 74
|
||||
# chkconfig: 345 65 35
|
||||
# description: Starts the OpenNebula daemon
|
||||
# processname: opennebula
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
# Description: start and stop opennebula
|
||||
### END INIT INFO
|
||||
|
||||
prog="opennebula"
|
||||
|
||||
ONE_BIN=/usr/bin/one
|
||||
LOCKFILE=/var/lock/subsys/${prog}
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
@@ -35,21 +38,28 @@ check() {
|
||||
|
||||
start() {
|
||||
check
|
||||
|
||||
echo -n $"Starting OpenNebula daemon: "
|
||||
daemon --user oneadmin $ONE_BIN start
|
||||
RETVAL=$?
|
||||
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch $LOCKFILE
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
||||
check
|
||||
|
||||
echo -n $"Stopping OpenNebula daemon: "
|
||||
su oneadmin -s /bin/sh -c "$ONE_BIN stop"
|
||||
daemon --user oneadmin $ONE_BIN stop
|
||||
RETVAL=$?
|
||||
|
||||
[ $RETVAL -eq 0 ] && success || failure
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
@@ -70,7 +80,7 @@ restart)
|
||||
restart
|
||||
;;
|
||||
status)
|
||||
status opennebula
|
||||
status $prog
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Starts the OCCI Server
|
||||
#
|
||||
# chkconfig: 345 26 74
|
||||
# chkconfig: 345 66 34
|
||||
# description: Starts the OpenNebula daemon
|
||||
# processname: opennebula-occi
|
||||
|
||||
@@ -18,27 +18,39 @@
|
||||
# Description: start and stop oned
|
||||
### END INIT INFO
|
||||
|
||||
prog="opennebula-occi"
|
||||
|
||||
OCCI_BIN=/usr/bin/occi-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 oned is executable
|
||||
# Check if occid is executable
|
||||
test -x $OCCI_BIN || exit 5
|
||||
}
|
||||
|
||||
start() {
|
||||
check
|
||||
|
||||
echo -n $"Starting OCCI Server: "
|
||||
daemon --user oneadmin $OCCI_BIN start
|
||||
RETVAL=$?
|
||||
echo
|
||||
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && {
|
||||
touch $LOCKFILE
|
||||
echo $(ps -ef|grep occi-server.rb | awk '{print $2}') > $PID_FILE
|
||||
}
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
@@ -46,10 +58,14 @@ stop() {
|
||||
|
||||
check
|
||||
|
||||
echo -n $"Stopping OCCI Server: "
|
||||
su oneadmin -s /bin/sh -c "$OCCI_BIN stop"
|
||||
echo -n $"Stopping OCCI Server daemon: "
|
||||
daemon --user oneadmin $OCCI_BIN stop
|
||||
RETVAL=$?
|
||||
|
||||
[ $RETVAL -eq 0 ] && success || failure
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE $PID_FILE
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
@@ -70,7 +86,7 @@ restart)
|
||||
restart
|
||||
;;
|
||||
status)
|
||||
status opennebula-occi
|
||||
status $prog
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Starts the Sunstone Server
|
||||
#
|
||||
# chkconfig: 345 26 74
|
||||
# chkconfig: 345 66 34
|
||||
# description: Starts the OpenNebula daemon
|
||||
# processname: opennebula-sunstone
|
||||
|
||||
@@ -18,11 +18,16 @@
|
||||
# Description: start and stop opennebula-sunstone
|
||||
### END INIT INFO
|
||||
|
||||
SUNSTONE_BIN=/usr/bin/opennebula-sunstone
|
||||
prog="opennebula-sunstone"
|
||||
|
||||
SUNSTONE_BIN=/usr/bin/sunstone-server
|
||||
LOCKFILE=/var/lock/subsys/${prog}
|
||||
PID_FILE=/var/run/${prog}.pid
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
|
||||
RETVAL=0
|
||||
|
||||
check() {
|
||||
@@ -35,21 +40,31 @@ check() {
|
||||
|
||||
start() {
|
||||
check
|
||||
echo -n $"Starting Sunstone Server: "
|
||||
|
||||
echo -n $"Starting Sunstone Server daemon: "
|
||||
daemon --user oneadmin $SUNSTONE_BIN start
|
||||
RETVAL=$?
|
||||
echo
|
||||
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && {
|
||||
touch $LOCKFILE
|
||||
echo $(ps -ef|grep su[n]stone-server | awk '{print $2}') > $PID_FILE
|
||||
}
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
||||
check
|
||||
|
||||
echo -n $"Stopping Sunstone Server: "
|
||||
su oneadmin -s /bin/sh -c "$SUNSTONE_BIN stop"
|
||||
echo -n $"Stopping Sunstone Server daemon: "
|
||||
daemon --user oneadmin $SUNSTONE_BIN stop
|
||||
RETVAL=$?
|
||||
echo
|
||||
|
||||
[ $RETVAL -eq 0 ] && success || failure
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE $PID_FILE
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
@@ -70,7 +85,7 @@ restart)
|
||||
restart
|
||||
;;
|
||||
status)
|
||||
status opennebula-sunstone
|
||||
status $prog
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in new issue
Block a user