fixed status handling

This commit is contained in:
Louwrentius 2009-09-26 20:43:24 +00:00
parent 3a8257e519
commit 9a880c313d

20
ppss.sh
View File

@ -644,6 +644,7 @@ init_vars () {
if [ ! "$?" == "0" ] if [ ! "$?" == "0" ]
then then
echo "ERROR: remote output dir $REMOTE_OUTPUT_DIR does not exist." echo "ERROR: remote output dir $REMOTE_OUTPUT_DIR does not exist."
set_status STOPPED
cleanup cleanup
exit exit
fi fi
@ -720,6 +721,7 @@ check_status () {
if [ ! "$ERROR" == "0" ] if [ ! "$ERROR" == "0" ]
then then
log INFO "$FUNCTION - $MESSAGE" log INFO "$FUNCTION - $MESSAGE"
set_status STOPPED
cleanup cleanup
exit 1 exit 1
fi fi
@ -736,15 +738,9 @@ erase_ppss () {
then then
for NODE in `cat $NODES_FILE` for NODE in `cat $NODES_FILE`
do do
does_file_exist "ppss" log INFO "Erasing PPSS homedir $PPSS_HOME_DIR from node $NODE."
if [ "$?" == "0" ] ssh -q $SSH_KEY $SSH_OPTS $USER@$NODE "./$PPSS_HOME_DIR/$0 kill"
then ssh -q $SSH_KEY $SSH_OPTS $USER@$NODE "rm -rf $PPSS_HOME_DIR"
log INFO "Erasing PPSS homedir $PPSS_HOME_DIR from node $NODE."
ssh -q $SSH_KEY $SSH_OPTS $USER@$NODE "./$PPSS_HOME_DIR/$0 kill"
ssh -q $SSH_KEY $SSH_OPTS $USER@$NODE "rm -rf $PPSS_HOME_DIR"
else
log INFO "PPSS was not present on node $NODE."
fi
done done
else else
log INFO "Aborting.." log INFO "Aborting.."
@ -823,6 +819,7 @@ deploy_ppss () {
if [ -z "$NODES_FILE" ] if [ -z "$NODES_FILE" ]
then then
log INFO "ERROR - are you using the right option? -C ?" log INFO "ERROR - are you using the right option? -C ?"
set_status ERROR
cleanup cleanup
exit 1 exit 1
fi fi
@ -847,6 +844,7 @@ deploy_ppss () {
if [ ! -e "$NODES_FILE" ] if [ ! -e "$NODES_FILE" ]
then then
log ERROR "File $NODES with list of nodes does not exist." log ERROR "File $NODES with list of nodes does not exist."
set_status ERROR
cleanup cleanup
exit 1 exit 1
else else
@ -990,6 +988,7 @@ random_delay () {
if [ -z "$ARGS" ] if [ -z "$ARGS" ]
then then
log ERROR "$FUNCNAME Function random delay, no argument specified." log ERROR "$FUNCNAME Function random delay, no argument specified."
set_status ERROR
exit 1 exit 1
fi fi
@ -1212,6 +1211,7 @@ get_all_items () {
if [ "$SIZE_OF_ARRAY" -le "0" ] if [ "$SIZE_OF_ARRAY" -le "0" ]
then then
log ERROR "Source file/dir seems to be empty." log ERROR "Source file/dir seems to be empty."
set_status STOPPED
cleanup cleanup
exit 1 exit 1
fi fi
@ -1453,6 +1453,7 @@ listen_for_job () {
fi fi
done done
kill_process kill_process
set_status STOPPED
log DEBUG "Listener stopped." log DEBUG "Listener stopped."
} }
@ -1563,6 +1564,7 @@ main () {
if [ ! -e "$NODES_FILE" ] if [ ! -e "$NODES_FILE" ]
then then
log ERROR "File $NODES with list of nodes does not exist." log ERROR "File $NODES with list of nodes does not exist."
set_status STOPPED
cleanup cleanup
exit 1 exit 1
else else