]> arthur.barton.de Git - backup-script.git/commitdiff
Allow handling of more than one target system at once
authorAlexander Barton <alex@barton.de>
Wed, 8 May 2013 09:17:08 +0000 (11:17 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 8 May 2013 09:17:08 +0000 (11:17 +0200)
bin/backup-script

index d1164a0e0564e0910ac7f7499f2697126c89a6a3..61221787a61acdece0fee91cae0626d6196cb233 100755 (executable)
@@ -31,10 +31,12 @@ if [ "$1" == "-p" ]; then
        shift
 fi
 
-if [ $# -gt 1 ]; then
-       echo "Usage: $NAME [-p] [<system>]"
+case "$1" in
+    "-"*)
+       echo "Usage: $NAME [-p] [<system> [<system> [...]]]"
        exit 1
-fi
+       ;;
+esac
 
 Log() {
        logger -t "$NAME" "$*"
@@ -72,11 +74,13 @@ GotSignal() {
 }
 
 if [ $# -ge 1 ]; then
-       sys=${CONF_D}/$1
-       if [ ! -r "$sys" ]; then
-               echo "$NAME: Can' read \"$sys\"!"
-               exit 1
-       fi
+       for s in $@; do
+               if [ ! -r "${CONF_D}/$s" ]; then
+                       echo "$NAME: Can' read \"${CONF_D}/$s\"!"
+                       exit 1
+               fi
+               sys="$sys ${CONF_D}/$s"
+       done
 else
        sys=${CONF_D}/*
 fi