]> git.treefish.org Git - backmeupscotty.git/commitdiff
adding force flag
authorAlexander Schmidt <alex@treefish.org>
Thu, 1 Oct 2020 08:11:14 +0000 (10:11 +0200)
committerAlexander Schmidt <alex@treefish.org>
Thu, 1 Oct 2020 08:11:14 +0000 (10:11 +0200)
backmeupscotty

index e1fe9a54d2387bd72c79fa398251056e43c6b4cd..efd283f6cc772225c35e9344a2a669adccc567c6 100644 (file)
@@ -6,6 +6,7 @@ ARCHIVE_KEEPNBACKUPS=30
 ARCHIVE_KEEPNDAYS=30
 BACKUP_RUNEVERYNTHDAY=1
 BWLIMIT=500KiB
+BACKUP_FORCE=0
 
 _ERROR_ENCOUNTERED=0
 
@@ -183,12 +184,13 @@ Usage: $(basename $0) [OPTION]...
 Recognized options:
   -q   Only output errors
   -n   Run only on nth day
+  -f   Force backup
   -h   Print out this help
 EOF
 }
 
 function backmeupscotty {
-    while getopts "qn:h" opt; do
+    while getopts "qn:fh" opt; do
         case $opt in
             q)
                 exec > /dev/null
@@ -196,6 +198,9 @@ function backmeupscotty {
             n)
                 BACKUP_RUNEVERYNTHDAY=$OPTARG
                 ;;
+            f)
+                BACKUP_FORCE=1
+                ;;
             h)
                 printhelp
                 exit 0
@@ -205,7 +210,9 @@ function backmeupscotty {
 
     ssh255 $REMOTE_HOST exit
 
-    if latestTooOld; then
+    if [ $BACKUP_FORCE -eq 1 ]; then
+        scottyinfo "Backup was enforced."
+    elif latestTooOld; then
         scottyerror "The latest backup is too old."
     elif isNthDay; then
         scottyinfo "This is the nth day."