From d2499f8f3f044a5142175848ff5e036f13cf5c01 Mon Sep 17 00:00:00 2001 From: Manevolent Date: Tue, 18 May 2021 17:52:36 -0600 Subject: [PATCH] Daemon: set -e --- run.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/run.sh b/run.sh index 949f6ec..1c352c2 100644 --- a/run.sh +++ b/run.sh @@ -3,20 +3,19 @@ delay=900 version_file=/etc/lixonet/version while true do - { - current_version=`cat $version_file || echo 0` && - git fetch && - latest_commit=`git log "--format=%G? %H" | grep ^G | head -n 1 | cut -d' ' -f2` && - git checkout $latest_commit && - checkout_version=`cat version` && + ( + set -e + current_version=`cat $version_file || echo 0` + git fetch + latest_commit=`git log "--format=%G? %H" | grep ^G | head -n 1 | cut -d' ' -f2` + git checkout $latest_commit + checkout_version=`cat version` if [ "$checkout_version" -gt "$current_version" ]; then - echo "Updating to version $checkout_version..." && - chmod +x build.sh && ./build.sh && - echo "Updated to version $checkout_version." && + echo "Updating to version $checkout_version..." + chmod +x build.sh && ./build.sh + echo "Updated to version $checkout_version." echo $checkout_version > $version_file fi - } || { - echo "Failed to update repository. Trying again in $delay seconds." - } + ) sleep $delay done \ No newline at end of file