From aa5fcbf3af1cbe4a55f67c00a4b3e57a94e45a36 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 13 Sep 2012 12:54:07 +0200 Subject: [PATCH] Fix *-server start|stop .lock file creation --- src/cloud/ec2/bin/econe-server | 15 +++++++++------ src/cloud/occi/bin/occi-server | 14 ++++++++------ src/ozones/Server/bin/ozones-server | 7 +++++-- src/sunstone/bin/sunstone-server | 10 +++++++--- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/cloud/ec2/bin/econe-server b/src/cloud/ec2/bin/econe-server index 976175ee79..6d6bd6740b 100755 --- a/src/cloud/ec2/bin/econe-server +++ b/src/cloud/ec2/bin/econe-server @@ -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" } diff --git a/src/cloud/occi/bin/occi-server b/src/cloud/occi/bin/occi-server index 812407b162..f121105fbf 100755 --- a/src/cloud/occi/bin/occi-server +++ b/src/cloud/occi/bin/occi-server @@ -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 diff --git a/src/ozones/Server/bin/ozones-server b/src/ozones/Server/bin/ozones-server index fe2843754b..4dfdaf52d5 100755 --- a/src/ozones/Server/bin/ozones-server +++ b/src/ozones/Server/bin/ozones-server @@ -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" } diff --git a/src/sunstone/bin/sunstone-server b/src/sunstone/bin/sunstone-server index e4a4847ad4..99d38d7e77 100755 --- a/src/sunstone/bin/sunstone-server +++ b/src/sunstone/bin/sunstone-server @@ -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" }