diff --git a/src/Misc/layoutbin/update.sh.template b/src/Misc/layoutbin/update.sh.template index 82ada18b917..8b0e04f0596 100755 --- a/src/Misc/layoutbin/update.sh.template +++ b/src/Misc/layoutbin/update.sh.template @@ -30,13 +30,13 @@ date "+[%F %T-%4N] Waiting for $runnerprocessname ($runnerpid) to complete" >> " while [ -e /proc/$runnerpid ] do date "+[%F %T-%4N] Process $runnerpid still running" >> "$logfile" 2>&1 - "$rootfolder"/safe_sleep.sh 2 + sleep 2 done date "+[%F %T-%4N] Process $runnerpid finished running" >> "$logfile" 2>&1 # start re-organize folders date "+[%F %T-%4N] Sleep 1 more second to make sure process exited" >> "$logfile" 2>&1 -"$rootfolder"/safe_sleep.sh 1 +sleep 1 # the folder structure under runner root will be # ./bin -> bin.2.100.0 (junction folder) diff --git a/src/Misc/layoutroot/run-helper.sh.template b/src/Misc/layoutroot/run-helper.sh.template index 9f2b3cc4457..a8e212b8d2a 100755 --- a/src/Misc/layoutroot/run-helper.sh.template +++ b/src/Misc/layoutroot/run-helper.sh.template @@ -27,7 +27,7 @@ if [ ! -z "$RUNNER_WAIT_FOR_DOCKER_IN_SECONDS" ]; then echo "Docker is ready." break fi - "$DIR"/safe_sleep.sh 1 + sleep 1 done fi fi @@ -44,7 +44,7 @@ elif [[ $returnCode == 1 ]]; then exit 0 elif [[ $returnCode == 2 ]]; then echo "Runner listener exit with retryable error, re-launch runner in 5 seconds." - "$DIR"/safe_sleep.sh 5 + sleep 5 exit 2 elif [[ $returnCode == 3 ]]; then # Wait for 30 seconds or for flag file to exists for the runner update process finish @@ -55,7 +55,7 @@ elif [[ $returnCode == 3 ]]; then rm "$updateFile" break fi - "$DIR"/safe_sleep.sh 1 + sleep 1 done exit 2 elif [[ $returnCode == 4 ]]; then @@ -67,7 +67,7 @@ elif [[ $returnCode == 4 ]]; then rm "$updateFile" break fi - "$DIR"/safe_sleep.sh 1 + sleep 1 done exit 2 elif [[ $returnCode == 5 ]]; then diff --git a/src/Misc/layoutroot/safe_sleep.sh b/src/Misc/layoutroot/safe_sleep.sh deleted file mode 100644 index 7b61c584ee9..00000000000 --- a/src/Misc/layoutroot/safe_sleep.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# try to use sleep if available -if [ -x "$(command -v sleep)" ]; then - sleep "$1" - exit 0 -fi - -# try to use ping if available -if [ -x "$(command -v ping)" ]; then - ping -c $(( $1 + 1 )) 127.0.0.1 > /dev/null - exit 0 -fi - -# try to use read -t from stdin/stdout/stderr if we are in bash -if [ -n "$BASH_VERSION" ]; then - if command -v read >/dev/null 2>&1; then - if [ -t 0 ]; then - read -t "$1" -u 0 || :; - exit 0 - fi - if [ -t 1 ]; then - read -t "$1" -u 1 || :; - exit 0 - fi - if [ -t 2 ]; then - read -t "$1" -u 2 || :; - exit 0 - fi - fi -fi - -# fallback to a busy wait -SECONDS=0 -while [[ $SECONDS -lt $1 ]]; do - : -done diff --git a/src/dev.sh b/src/dev.sh index cd589bf9ea6..56373497c0b 100755 --- a/src/dev.sh +++ b/src/dev.sh @@ -138,7 +138,6 @@ function layout () chmod +x "${LAYOUT_DIR}/bin/Runner.Worker" chmod +x "${LAYOUT_DIR}/bin/Runner.PluginHost" chmod +x "${LAYOUT_DIR}/bin/installdependencies.sh" - chmod +x "${LAYOUT_DIR}/safe_sleep.sh" fi heading "Setup externals folder for $RUNTIME_ID runner's layout"