From f75a0bf675b1ba2f68d5aede1d9be210b54490d4 Mon Sep 17 00:00:00 2001 From: Regina Kleinhappel Date: Tue, 29 Jul 2014 23:51:58 +0200 Subject: [PATCH] Repaired nth day option. --- backmeupscotty | 27 ++++++++++++++------------- backmeupscotty-example | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) 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 $@ -- 2.39.5