From 751b37c2c8b67af5b7db0a695c1654eb5fa0b9e8 Mon Sep 17 00:00:00 2001 From: JuliusFreudenberger Date: Sun, 20 Feb 2022 19:14:19 +0100 Subject: [PATCH] Add going to script dir to allow execution from any folder --- backup_script.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backup_script.sh b/backup_script.sh index 5a97211..2a7f28d 100755 --- a/backup_script.sh +++ b/backup_script.sh @@ -16,6 +16,10 @@ checkInput() { done } +goIntoScriptDirectory() { + cd $(dirname "${BASH_SOURCE[0]}") +} + checkForHooks() { test -f "$HOOKS.sh" && HAS_HOOKS=1 } @@ -71,6 +75,7 @@ exitPrematurely() { # Backup the service and call healthchecks backup() { checkInput + goIntoScriptDirectory healthStart checkForHooks