]> git.treefish.org Git - backmeupscotty.git/commitdiff
Add functionality to list existing backups
authorAlexander Schmidt <alex@treefish.org>
Mon, 21 Aug 2023 20:16:13 +0000 (22:16 +0200)
committerAlexander Schmidt <alex@treefish.org>
Mon, 21 Aug 2023 20:16:13 +0000 (22:16 +0200)
backmeupscotty

index efd283f6cc772225c35e9344a2a669adccc567c6..579b63a53e18f2f301d809e0be5a90fd76286926 100644 (file)
@@ -185,12 +185,13 @@ Recognized options:
   -q   Only output errors
   -n   Run only on nth day
   -f   Force backup
+  -l   List existing backups
   -h   Print out this help
 EOF
 }
 
 function backmeupscotty {
-    while getopts "qn:fh" opt; do
+    while getopts "qn:flh" opt; do
         case $opt in
             q)
                 exec > /dev/null
@@ -201,6 +202,9 @@ function backmeupscotty {
             f)
                 BACKUP_FORCE=1
                 ;;
+           l)
+               LIST_BACKUPS=1
+               ;;
             h)
                 printhelp
                 exit 0
@@ -210,6 +214,13 @@ function backmeupscotty {
 
     ssh255 $REMOTE_HOST exit
 
+    if [ $LIST_BACKUPS ]; then
+       for backup in $(grepbackups); do
+           echo $backup
+       done
+       exit 0
+    fi
+
     if [ $BACKUP_FORCE -eq 1 ]; then
         scottyinfo "Backup was enforced."
     elif latestTooOld; then