1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-25 04:48:37 -06:00

chg: Exit some scripts when part of it fails

This commit is contained in:
Sayantan Santra 2024-12-02 12:30:01 -06:00
parent fd9c80b3fe
commit 17506c39ab
Signed by: SinTan1729
GPG key ID: 0538DD402EA50898
4 changed files with 12 additions and 0 deletions

View file

@ -5,6 +5,9 @@
# Syntax get-best-mirrors.sh <arch|eos|both> (nothing means both) # Syntax get-best-mirrors.sh <arch|eos|both> (nothing means both)
# I run it weekly using anacron. # I run it weekly using anacron.
# Exit the whole script when ctrl+c is pressed
set -e
update_arch() { update_arch() {
# Create temporary file to output to # Create temporary file to output to
TMPFILE_ARCH="$(mktemp)" TMPFILE_ARCH="$(mktemp)"

View file

@ -7,6 +7,9 @@ if [ "$(id -u)" -eq 0 ]; then
exec sudo -H -u sintan $0 "$@" exec sudo -H -u sintan $0 "$@"
fi fi
# Exit the whole script when ctrl+c is pressed
set -e
# Run only one instance of this script at one time # Run only one instance of this script at one time
[ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk.lock" "$0" "$@" || : [ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk.lock" "$0" "$@" || :

View file

@ -8,6 +8,9 @@ if [ "$(id -u)" -eq 0 ]; then
exec sudo -H -u sintan $0 "$@" exec sudo -H -u sintan $0 "$@"
fi fi
# Exit the whole script when ctrl+c is pressed
set -e
# Run only one instance of this script at one time # Run only one instance of this script at one time
[ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk.lock" "$0" "$@" || : [ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk.lock" "$0" "$@" || :

View file

@ -5,6 +5,9 @@
# Syntax: update-aur-lure.sh <package-name> <new-version> # Syntax: update-aur-lure.sh <package-name> <new-version>
# Exit the whole script when ctrl+c is pressed
set -e
if [ "$#" -ne 2 ]; then if [ "$#" -ne 2 ]; then
echo "Invalid syntax!" echo "Invalid syntax!"
echo "Use the following syntax: update-aur-lure.sh <package-name> <new-version>" echo "Use the following syntax: update-aur-lure.sh <package-name> <new-version>"