1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-10 01:17:40 +03:00

enhanced handling of oned and scheduler processess.

git-svn-id: http://svn.opennebula.org/trunk@70 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
Constantino Vázquez Blanco 2008-07-22 15:55:33 +00:00
parent 315cea65e5
commit 7a4e349ea1

View File

@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/sh
if [ -z "$ONE_LOCATION" ]; then
echo "ONE_LOCATION is not defined"
@ -20,6 +20,27 @@ setup()
echo "Can not find PORT in $ONE_CONF."
exit 1
fi
if [ -f $ONE_LOCATION/var/.lock ]; then
if [ -f $ONE_PID ]; then
ONEPID=`cat $ONE_PID`
ps $ONEPID &> /dev/null
if [ $? -eq 0 ]; then
echo "ONE is still running (PID:$ONEPID). Please try 'one stop' first."
exit 1
fi
fi
if [ -f $ONE_SCHEDPID ]; then
ONESCHEDPID=`cat $ONE_SCHEDPID`
ps $ONESCHEDPID &> /dev/null
if [ $? -eq 0 ]; then
echo "The scheduler is still running (PID:$ONEPID). Please try 'one stop' first."
exit 1
fi
fi
echo "Stale .lock detected. Erasing it."
rm $ONE_LOCATION/var/.lock
fi
}
start()
@ -80,11 +101,11 @@ stop()
# Kill the one daemon
kill `cat $ONE_PID`
kill `cat $ONE_PID` &> /dev/null
# Kill the scheduler
kill `cat $ONE_SCHEDPID`
kill `cat $ONE_SCHEDPID` &> /dev/null
# Remove pid files
@ -98,7 +119,7 @@ stop()
case "$1" in
start)
setup
start
start
;;
stop)
stop