From 3ed5497b057076f284ba71f975f8e0a5a16085c1 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Tue, 18 Aug 2015 10:31:02 +0200 Subject: [PATCH] Look for configuration file in /usr/local/etc/, too --- bin/backup-script | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/bin/backup-script b/bin/backup-script index 3ce8db1..95b376c 100755 --- a/bin/backup-script +++ b/bin/backup-script @@ -258,6 +258,15 @@ Initialize_Last_SysTarget_Snapshot() { return 0 } +# Search configuration file (last one is used as default!) +for conf in \ + "/usr/local/etc/backup-script.conf" \ + "${conf_d}/backup-script.conf" \ + "/etc/backup-script.conf" \ +; do + [ -r "$conf" ] && break +done + while [ $# -gt 0 ]; do case "$1" in "-n"|"--dry-run") @@ -278,12 +287,13 @@ trap GotSignal SIGINT echo -n "Started: "; date -for conf in "/etc/backup-script.conf" "${conf_d}/backup-script.conf"; do - if [ -r "$conf" ]; then - echo "Reading configuration: \"$conf\" ..." - source "$conf" - fi -done +# Read in configuration file +if [ -r "$conf" ]; then + echo "Reading configuration: \"$conf\" ..." + source "$conf" +else + echo "No configuration file found, using defaults." +fi echo if [ $# -ge 1 ]; then -- 2.39.2