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:
parent
fd9c80b3fe
commit
17506c39ab
4 changed files with 12 additions and 0 deletions
|
@ -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)"
|
||||||
|
|
|
@ -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" "$@" || :
|
||||||
|
|
||||||
|
|
|
@ -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" "$@" || :
|
||||||
|
|
||||||
|
|
|
@ -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>"
|
||||||
|
|
Loading…
Reference in a new issue