1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Fix *-server start|stop .lock file creation

This commit is contained in:
Daniel Molina 2012-09-13 12:54:07 +02:00
parent c6548cdb71
commit aa5fcbf3af
4 changed files with 29 additions and 17 deletions

View File

@ -43,15 +43,15 @@ setup()
if [ -f $ECONE_LOCK_FILE ]; then
if [ -f $ECONE_PID ]; then
ONEPID=`cat $ECONE_PID`
ps $ECONE_PID > /dev/null 2>&1
ECONEPID=`cat $ECONE_PID`
ps $ECONEPID > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "econe-server is still running (PID:$ECONE_PID). Please try 'occi-server stop' first."
echo "econe-server is still running (PID:$ECONEPID). Please try 'econe-server stop' first."
exit 1
fi
fi
echo "Stale .lock detected. Erasing it."
rm $LOCK_FILE
rm $ECONE_LOCK_FILE
fi
}
@ -62,6 +62,8 @@ start()
exit 1
fi
touch $ECONE_LOCK_FILE
# Start the econe-server daemon
ruby $ECONE_SERVER >$ECONE_LOG 2>$ECONE_LOG_ERROR &
@ -70,7 +72,7 @@ start()
if [ $LASTRC -ne 0 ]; then
echo "Error executing econe-server."
echo "Check $ECONE_LOG for more information"
echo "Check $ECONE_LOG_ERROR and $ECONE_LOG for more information"
exit 1
else
echo $LASTPID > $ECONE_PID
@ -81,7 +83,7 @@ start()
if [ $? -ne 0 ]; then
echo "Error executing econe-server."
echo "Check $ECONE_LOG for more information"
echo "Check $ECONE_LOG_ERROR and $ECONE_LOG for more information"
exit 1
fi
@ -105,6 +107,7 @@ stop()
# Remove pid files
rm -f $ECONE_PID > /dev/null 2>&1
rm -f $ECONE_LOCK_FILE > /dev/null 2>&1
echo "econe-server stopped"
}

View File

@ -43,15 +43,15 @@ setup()
if [ -f $OCCI_LOCK_FILE ]; then
if [ -f $OCCI_PID ]; then
ONEPID=`cat $OCCI_PID`
ps $OCCI_PID > /dev/null 2>&1
OCCIPID=`cat $OCCI_PID`
ps $OCCIPID > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "OCCI Server is still running (PID:$OCCI_PID). Please try 'occi-server stop' first."
echo "OCCI Server is still running (PID:$OCCIPID). Please try 'occi-server stop' first."
exit 1
fi
fi
echo "Stale .lock detected. Erasing it."
rm $LOCK_FILE
rm $OCCI_LOCK_FILE
fi
}
@ -62,6 +62,8 @@ start()
exit 1
fi
touch $OCCI_LOCK_FILE
# Start the occi-server daemon
ruby $OCCI_SERVER >$OCCI_LOG 2>$OCCI_LOG_ERROR &
@ -70,7 +72,7 @@ start()
if [ $LASTRC -ne 0 ]; then
echo "Error executing occi-server."
echo "Check $OCCI_LOG for more information"
echo "Check $OCCI_LOG_ERROR and $OCCI_LOG for more information"
exit 1
else
echo $LASTPID > $OCCI_PID
@ -81,7 +83,7 @@ start()
if [ $? -ne 0 ]; then
echo "Error executing occi-server."
echo "Check $OCCI_LOG for more information"
echo "Check $OCCI_LOG_ERROR and $OCCI_LOG for more information"
exit 1
fi

View File

@ -65,7 +65,8 @@ start()
ruby $OZONES_SERVER > $OZONES_LOG 2>$OZONES_LOG_ERROR &
LASTPID=$!
if [ $? -ne 0 ]; then
echo "Error executing $OZONES_SERVER, please check the log $OZONES_LOG"
echo "Error executing ozones-server."
echo "Check $OZONES_LOG_ERROR and $OZONES_LOG for more information"
exit 1
else
echo $LASTPID > $OZONES_PID
@ -75,7 +76,8 @@ start()
ps $LASTPID &> /dev/null
if [ $? -ne 0 ]; then
echo "Error executing $OZONES_SERVER, please check the log $OZONES_LOG"
echo "Error executing ozones-server."
echo "Check $OZONES_LOG_ERROR and $OZONES_LOG for more information"
exit 1
fi
@ -97,6 +99,7 @@ stop()
# Remove pid files
rm -f $OZONES_LOCK_FILE &> /dev/null
rm -f $OZONES_PID &> /dev/null
echo "ozones-server stopped"
}

View File

@ -64,13 +64,15 @@ start()
echo "Cannot find $SUNSTONE_SERVER."
exit 1
fi
# Start the sunstone daemon
touch $SUNSTONE_LOCK_FILE
ruby $SUNSTONE_SERVER > $SUNSTONE_LOG 2>$SUNSTONE_LOG_ERROR &
LASTPID=$!
if [ $? -ne 0 ]; then
echo "Error executing $SUNSTONE_SERVER, please check the log $SUNSTONE_LOG"
echo "Error executing sunstone-server."
echo "Check $SUNSTONE_LOG_ERROR and $SUNSTONE_LOG for more information"
exit 1
else
echo $LASTPID > $SUNSTONE_PID
@ -80,7 +82,8 @@ start()
ps $LASTPID &> /dev/null
if [ $? -ne 0 ]; then
echo "Error executing $SUNSTONE_SERVER, please check the log $SUNSTONE_LOG"
echo "Error executing sunstone-server."
echo "Check $SUNSTONE_LOG_ERROR and $SUNSTONE_LOG for more information"
exit 1
fi
@ -102,6 +105,7 @@ stop()
# Remove pid files
rm -f $SUNSTONE_LOCK_FILE &> /dev/null
rm -f $SUNSTONE_PID &> /dev/null
echo "sunstone-server stopped"
}