]> git.treefish.org Git - backmeupscotty.git/commitdiff
Repaired nth day option.
authorRegina Kleinhappel <regina@treefish.org>
Tue, 29 Jul 2014 21:51:58 +0000 (23:51 +0200)
committerRegina Kleinhappel <regina@treefish.org>
Tue, 29 Jul 2014 21:51:58 +0000 (23:51 +0200)
backmeupscotty
backmeupscotty-example

index c1fa9da8387aea23f276e1092c8abf31c9fd191c..efda418d28119de54b1f9fc4617192c8ce8dd34c 100644 (file)
@@ -141,10 +141,20 @@ function cleanup_normal {
 
 function _cleanup_normal {
     cleanup_normal
-    deleteLock
 }
 
 function backmeupscotty {
+    while getopts "qn:" opt; do
+       case $opt in
+           q)
+               exec > /dev/null
+               ;;
+           n)
+               BACKUP_RUNEVERYNTHDAY=$OPTARG
+               ;;
+       esac
+    done
+
     if ! isIncompleteOrNthDay; then
        scottyinfo "This is not the nth day and no incomplete backup exists."
        exit 0
@@ -156,21 +166,12 @@ function backmeupscotty {
     scottysync
     _cleanup_normal
 
-    trap - EXIT
+    trap deleteLock EXIT
 }
 
 if ! mkdir /tmp/$(basename $0).lock; then
     scottyerror "Another instance of $(basename $0) is still running!"
     exit 1
+else
+    trap deleteLock EXIT
 fi
-
-while getopts "qn:" opt; do
-    case $opt in
-       q)
-           exec > /dev/null
-           ;;
-       n)
-           BACKUP_RUNEVERYNTHDAY=$OPTARG
-           ;;
-    esac
-done
index 9418571c3ca1688a566ccfc722448d4723143325..cad9631b0fd3743ec5d2a0eeb76c14dd2d5f9be6 100755 (executable)
@@ -22,4 +22,4 @@ function cleanup_abrt {
     echo "cleanup_abrt"
 }
 
-backmeupscotty
+backmeupscotty $@