From 17506c39ab7b41e09fe5a0d000e67289381ccdce Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Mon, 2 Dec 2024 12:30:01 -0600 Subject: [PATCH] chg: Exit some scripts when part of it fails --- get-best-mirrors.sh | 3 +++ impfilesbk | 3 +++ impfilesbk_server | 3 +++ update-aur-lure.sh | 3 +++ 4 files changed, 12 insertions(+) diff --git a/get-best-mirrors.sh b/get-best-mirrors.sh index 747a7d1..cd8c1fb 100644 --- a/get-best-mirrors.sh +++ b/get-best-mirrors.sh @@ -5,6 +5,9 @@ # Syntax get-best-mirrors.sh (nothing means both) # I run it weekly using anacron. +# Exit the whole script when ctrl+c is pressed +set -e + update_arch() { # Create temporary file to output to TMPFILE_ARCH="$(mktemp)" diff --git a/impfilesbk b/impfilesbk index 6aa8691..ea64a77 100644 --- a/impfilesbk +++ b/impfilesbk @@ -7,6 +7,9 @@ if [ "$(id -u)" -eq 0 ]; then exec sudo -H -u sintan $0 "$@" fi +# Exit the whole script when ctrl+c is pressed +set -e + # Run only one instance of this script at one time [ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk.lock" "$0" "$@" || : diff --git a/impfilesbk_server b/impfilesbk_server index 5c39d59..c1b37b0 100644 --- a/impfilesbk_server +++ b/impfilesbk_server @@ -8,6 +8,9 @@ if [ "$(id -u)" -eq 0 ]; then exec sudo -H -u sintan $0 "$@" fi +# Exit the whole script when ctrl+c is pressed +set -e + # Run only one instance of this script at one time [ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk.lock" "$0" "$@" || : diff --git a/update-aur-lure.sh b/update-aur-lure.sh index 981b417..6f9518c 100644 --- a/update-aur-lure.sh +++ b/update-aur-lure.sh @@ -5,6 +5,9 @@ # Syntax: update-aur-lure.sh +# Exit the whole script when ctrl+c is pressed +set -e + if [ "$#" -ne 2 ]; then echo "Invalid syntax!" echo "Use the following syntax: update-aur-lure.sh "