From: Regina Kleinhappel Date: Tue, 29 Jul 2014 21:51:58 +0000 (+0200) Subject: Repaired nth day option. X-Git-Url: https://git.treefish.org/~alex/backmeupscotty.git/commitdiff_plain/f75a0bf675b1ba2f68d5aede1d9be210b54490d4 Repaired nth day option. --- diff --git a/backmeupscotty b/backmeupscotty index c1fa9da..efda418 100644 --- a/backmeupscotty +++ b/backmeupscotty @@ -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 diff --git a/backmeupscotty-example b/backmeupscotty-example index 9418571..cad9631 100755 --- a/backmeupscotty-example +++ b/backmeupscotty-example @@ -22,4 +22,4 @@ function cleanup_abrt { echo "cleanup_abrt" } -backmeupscotty +backmeupscotty $@