diff --git a/compute/src/test/resources/initscript_with_java.sh b/compute/src/test/resources/initscript_with_java.sh index 6a9a7bc6f3..27c995dba6 100644 --- a/compute/src/test/resources/initscript_with_java.sh +++ b/compute/src/test/resources/initscript_with_java.sh @@ -44,13 +44,15 @@ function forget { findPid $INSTANCE_NAME [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && { echo $INSTANCE_NAME already running pid [$FOUND_PID] + return 1; } || { nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log & - sleep 1 - findPid $INSTANCE_NAME - [ -n "$FOUND_PID" ] || abort "$INSTANCE_NAME did not start" + RETURN=$? + # this is generally followed by findPid, so we shouldn't exit + # immediately as the proc may not have registered in ps, yet + test $RETURN && sleep 1 + return $RETURN; } - return 0 } export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin case $1 in @@ -101,7 +103,7 @@ grep `hostname` /etc/hosts >/dev/null || awk -v hostname=`hostname` 'END { print nslookup yahoo.com >/dev/null || echo nameserver 208.67.222.222 >> /etc/resolv.conf apt-get update -qq which curl || apt-get install -f -y -qq --force-yes curl -apt-get install -f -y -qq --force-yes openjdk-7-jdk||apt-get install -f -y -qq --force-yes openjdk-6-jdk +apt-get install -f -y -qq --force-yes openjdk-6-jdk echo "export PATH=\"\$JAVA_HOME/bin/:\$PATH\"" >> $HOME/.bashrc END_OF_SCRIPT diff --git a/compute/src/test/resources/initscript_with_jboss.sh b/compute/src/test/resources/initscript_with_jboss.sh index 603ba61916..3a9f8492db 100644 --- a/compute/src/test/resources/initscript_with_jboss.sh +++ b/compute/src/test/resources/initscript_with_jboss.sh @@ -44,13 +44,15 @@ function forget { findPid $INSTANCE_NAME [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && { echo $INSTANCE_NAME already running pid [$FOUND_PID] + return 1; } || { nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log & - sleep 1 - findPid $INSTANCE_NAME - [ -n "$FOUND_PID" ] || abort "$INSTANCE_NAME did not start" + RETURN=$? + # this is generally followed by findPid, so we shouldn't exit + # immediately as the proc may not have registered in ps, yet + test $RETURN && sleep 1 + return $RETURN; } - return 0 } export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin case $1 in @@ -101,7 +103,7 @@ grep `hostname` /etc/hosts >/dev/null || awk -v hostname=`hostname` 'END { print nslookup yahoo.com >/dev/null || echo nameserver 208.67.222.222 >> /etc/resolv.conf apt-get update -qq which curl || apt-get install -f -y -qq --force-yes curl -apt-get install -f -y -qq --force-yes openjdk-7-jdk||apt-get install -f -y -qq --force-yes openjdk-6-jdk +apt-get install -f -y -qq --force-yes openjdk-6-jdk echo "export PATH=\"\$JAVA_HOME/bin/:\$PATH\"" >> $HOME/.bashrc iptables -I INPUT 1 -p tcp --dport 22 -j ACCEPT iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT diff --git a/compute/src/test/resources/runscript.sh b/compute/src/test/resources/runscript.sh index 0f40396d6e..0fcc42dea2 100644 --- a/compute/src/test/resources/runscript.sh +++ b/compute/src/test/resources/runscript.sh @@ -44,13 +44,15 @@ function forget { findPid $INSTANCE_NAME [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && { echo $INSTANCE_NAME already running pid [$FOUND_PID] + return 1; } || { nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log & - sleep 1 - findPid $INSTANCE_NAME - [ -n "$FOUND_PID" ] || abort "$INSTANCE_NAME did not start" + RETURN=$? + # this is generally followed by findPid, so we shouldn't exit + # immediately as the proc may not have registered in ps, yet + test $RETURN && sleep 1 + return $RETURN; } - return 0 } export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin case $1 in @@ -80,7 +82,7 @@ grep `hostname` /etc/hosts >/dev/null || awk -v hostname=`hostname` 'END { print nslookup yahoo.com >/dev/null || echo nameserver 208.67.222.222 >> /etc/resolv.conf apt-get update -qq which curl || apt-get install -f -y -qq --force-yes curl -apt-get install -f -y -qq --force-yes openjdk-7-jdk||apt-get install -f -y -qq --force-yes openjdk-6-jdk +apt-get install -f -y -qq --force-yes openjdk-6-jdk echo "export PATH=\"\$JAVA_HOME/bin/:\$PATH\"" >> $HOME/.bashrc END_OF_SCRIPT diff --git a/compute/src/test/resources/runscript_adminUpdate.sh b/compute/src/test/resources/runscript_adminUpdate.sh index a2631875d3..c0e1056b01 100644 --- a/compute/src/test/resources/runscript_adminUpdate.sh +++ b/compute/src/test/resources/runscript_adminUpdate.sh @@ -44,13 +44,15 @@ function forget { findPid $INSTANCE_NAME [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && { echo $INSTANCE_NAME already running pid [$FOUND_PID] + return 1; } || { nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log & - sleep 1 - findPid $INSTANCE_NAME - [ -n "$FOUND_PID" ] || abort "$INSTANCE_NAME did not start" + RETURN=$? + # this is generally followed by findPid, so we shouldn't exit + # immediately as the proc may not have registered in ps, yet + test $RETURN && sleep 1 + return $RETURN; } - return 0 } export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin case $1 in diff --git a/compute/src/test/resources/runscript_jboss.sh b/compute/src/test/resources/runscript_jboss.sh index 29cccdc289..508b954785 100644 --- a/compute/src/test/resources/runscript_jboss.sh +++ b/compute/src/test/resources/runscript_jboss.sh @@ -45,13 +45,15 @@ function forget { findPid $INSTANCE_NAME [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && { echo $INSTANCE_NAME already running pid [$FOUND_PID] + return 1; } || { nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log & - sleep 1 - findPid $INSTANCE_NAME - [ -n "$FOUND_PID" ] || abort "$INSTANCE_NAME did not start" + RETURN=$? + # this is generally followed by findPid, so we shouldn't exit + # immediately as the proc may not have registered in ps, yet + test $RETURN && sleep 1 + return $RETURN; } - return 0 } export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin case $1 in diff --git a/scriptbuilder/src/main/resources/functions/forget.sh b/scriptbuilder/src/main/resources/functions/forget.sh index dbe5c0ce94..b4a9a2ef4e 100644 --- a/scriptbuilder/src/main/resources/functions/forget.sh +++ b/scriptbuilder/src/main/resources/functions/forget.sh @@ -11,11 +11,13 @@ function forget { findPid $INSTANCE_NAME [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && { echo $INSTANCE_NAME already running pid [$FOUND_PID] + return 1; } || { nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log & - sleep 1 - findPid $INSTANCE_NAME - [ -n "$FOUND_PID" ] || abort "$INSTANCE_NAME did not start" + RETURN=$? + # this is generally followed by findPid, so we shouldn't exit + # immediately as the proc may not have registered in ps, yet + test $RETURN && sleep 1 + return $RETURN; } - return 0 } diff --git a/scriptbuilder/src/test/resources/test_ebs.sh b/scriptbuilder/src/test/resources/test_ebs.sh index c2d2545518..d9dd5b7e3e 100644 --- a/scriptbuilder/src/test/resources/test_ebs.sh +++ b/scriptbuilder/src/test/resources/test_ebs.sh @@ -47,13 +47,15 @@ function forget { findPid $INSTANCE_NAME [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && { echo $INSTANCE_NAME already running pid [$FOUND_PID] + return 1; } || { nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log & - sleep 1 - findPid $INSTANCE_NAME - [ -n "$FOUND_PID" ] || abort "$INSTANCE_NAME did not start" + RETURN=$? + # this is generally followed by findPid, so we shouldn't exit + # immediately as the proc may not have registered in ps, yet + test $RETURN && sleep 1 + return $RETURN; } - return 0 } export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin case $1 in diff --git a/scriptbuilder/src/test/resources/test_init.sh b/scriptbuilder/src/test/resources/test_init.sh index 43d48b0a2a..e2231a2458 100644 --- a/scriptbuilder/src/test/resources/test_init.sh +++ b/scriptbuilder/src/test/resources/test_init.sh @@ -45,13 +45,15 @@ function forget { findPid $INSTANCE_NAME [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && { echo $INSTANCE_NAME already running pid [$FOUND_PID] + return 1; } || { nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log & - sleep 1 - findPid $INSTANCE_NAME - [ -n "$FOUND_PID" ] || abort "$INSTANCE_NAME did not start" + RETURN=$? + # this is generally followed by findPid, so we shouldn't exit + # immediately as the proc may not have registered in ps, yet + test $RETURN && sleep 1 + return $RETURN; } - return 0 } export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin case $1 in