X-Git-Url: http://git.treefish.org/~alex/backmeupscotty.git/blobdiff_plain/333d926de93d4427e4c32c52e7dd18649132a00b..f75a0bf675b1ba2f68d5aede1d9be210b54490d4:/backmeupscotty 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