diff --git a/.gitignore b/.gitignore index fe08cd88a25c75da17ffa316a15900d6dfd08540..6b5ad9a8324e1e4af5a99f9bd19f532a957bf0f8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ # ignored configs # ---------------------------------------------------------------------- jobs/*.job +logs/auto-* logs/full-* logs/inc-* logs/transfer-* diff --git a/check_clientbackup.sh b/check_clientbackup.sh index fc3724ec9b040d12f3ec5cf20dd919f80b14aabc..d01480d140157d25e2b9933f7a16de59b5959a81 100755 --- a/check_clientbackup.sh +++ b/check_clientbackup.sh @@ -46,7 +46,7 @@ else iMaxAgeInHours=`j_getLastBackupAge` echo verify last backup: $iMaxAgeInHours h ago - for logfile in `ls -1t $logdir/inc*.log $logdir/full*.log 2>/dev/null | head -1` + for logfile in `ls -1t $logdir/inc*.log $logdir/full*.log $logdir/auto*.log 2>/dev/null | head -1` do echo LAST BACKUP: $logfile grep "final.*rc=" $logfile @@ -87,13 +87,18 @@ else # --- changes (incremental backups only) and backup status infos echo - sSearch="|Args:|ElapsedTime|SourceFiles|SourceFileSize|RawDeltaSize" + sSearch="Args:|ElapsedTime|SourceFiles|SourceFileSize|RawDeltaSize" echo $logfile | fgrep "inc" >/dev/null if [ $? -eq 0 ]; then - sSearch="[ADM]\ ${sSearch}" + sSearch="[ADM]\ |${sSearch}" fi + echo --- changes: egrep "^(${sSearch})" $logfile + echo + echo --- summary of backed up directories: + grep "DIR\ " $logfile + sShort="$sShort - OK: $iOK ... Errors: $iError" done diff --git a/jobhelper.sh b/jobhelper.sh index 7d8d2f2b79bff6b657a7f4cc24ab1d38160331ea..1c45f7bb9b5cde355b09a6c80a022b4e42741a17 100755 --- a/jobhelper.sh +++ b/jobhelper.sh @@ -292,13 +292,22 @@ function j_read(){ BACKUP_TARGETDIR=`_j_getvar ${JOBFILE} "dir-local-dumps"` JOBDEF_TYPE=`_j_getvar ${JOBFILE} "type"` - if [ -z $JOBDEF_TYPE ]; then - JOBDEF_TYPE=inc + if [ -z "$JOBDEF_TYPE" ]; then + JOBDEF_TYPE=auto fi JOBDEF_INC=`_j_getvar ${JOBFILE} "inc"` JOBDEF_FULL=`_j_getvar ${JOBFILE} "full"` + JOBDEF_AUTO=`_j_getvar ${JOBFILE} "auto"` + if [ "$JOBDEF_TYPE" = "auto" ]; then + if [ -z "$JOBDEF_AUTO" ]; then + JOBDEF_AUTO=1W + fi + else + JOBDEF_AUTO= + fi + bIsTodayInc=`_j_isToday $JOBDEF_INC` bIsTodayFull=`_j_isToday $JOBDEF_FULL` diff --git a/jobs/backup.job.dist b/jobs/backup.job.dist index 99b05b4c97937ad0a9e8c9fc2eb60639f7996fa2..9d904b68d02ff6acf77148a43f4302850c39f7a3 100644 --- a/jobs/backup.job.dist +++ b/jobs/backup.job.dist @@ -12,7 +12,9 @@ # # ---------------------------------------------------------------------- -type = inc +# type = inc +type = auto + lang = en_us # ---------------------------------------------------------------------- @@ -20,12 +22,18 @@ lang = en_us # for inc and full you can set # DOM:06,22 - days of month # DOW:Mon,Fri - weekdays -# WDM:WDM:1st Fri - nth weekday in month +# WDM:1st Fri - nth weekday in month # ---------------------------------------------------------------------- inc = DOW:Mon,Tue,Wed,Thu,Fri,Sat,Sun + +# full backups for type = inc full = WDM:3rd Fri +# full backups for type = auto +# auto = <time> i.e. 1M +auto = 1M + # --- when to start every day? # incremental jobs diff --git a/restore.sh b/restore.sh index 1fee351a0d9ab6229910e75d6860734b36e28186..4fc09930ccb4ca2ae69875d8b7f50b77964b0a91 100755 --- a/restore.sh +++ b/restore.sh @@ -460,39 +460,39 @@ h1 "RESTORE - GET FILES FROM STORAGE" echo color input - echo -n "Select and Return --> " + echo -n "Select (not case sensitive) --> " color reset read action echo case $action in - d) + d|D) enterBackupDir ;; - t) + t|T) enterDate ;; - c) + c|C) showFilechanges ;; - s) + s|S) searchFile ;; - v) + v|V) verify ;; - b) + b|B) echo type exit to return... export PS1="[`basename $0` \u@\h \w]\$ " bash ;; - w) + w|W) enterRestoreitem ;; - r) + r|R) doRestore ;; - x) + x|X) exit 0 ;; *) diff --git a/scheduler.sh b/scheduler.sh index e6c6186c3cc465e4053a7cd401f01a7e8842526e..1104e356bdd302fee275f8e97d22bbf2bffd3a74 100755 --- a/scheduler.sh +++ b/scheduler.sh @@ -45,14 +45,12 @@ cat << EOFschedulerinfo - Job data - - Incremental backup: $JOBDEF_INC at `_j_getvar ${JOBFILE} "start-time-inc"` - Full backup : $JOBDEF_FULL at `_j_getvar ${JOBFILE} "start-time-full"` + execution times: $JOBDEF_INC at `_j_getvar ${JOBFILE} "start-time-inc"` + Full backup : $JOBDEF_FULL at `_j_getvar ${JOBFILE} "start-time-full"` do today = $JOB_DOTODAY - type = $JOBDEF_TYPE + type = $JOBDEF_TYPE $JOBDEF_AUTO starttime = $JOBDEF_STARTTIME stopfile = $JOB_DONEFILE @@ -68,6 +66,7 @@ EOFschedulerinfo # check: Backup bereits gelaufen? ls -l ${JOB_DONEFILE}.* 2>/dev/null if [ $? -eq 0 ]; then + echo echo "ABORT: $JOB_DONEFILE was found" bStart=0 else @@ -76,7 +75,7 @@ EOFschedulerinfo if [ ${JOBDEF_STARTTIME} -gt ${mytime} ]; then - echo "INFO: waiting for ${JOBDEF_STARTTIME} ..." + echo "INFO: waiting for next run at ${JOBDEF_STARTTIME} ..." bStart=0 fi @@ -121,7 +120,7 @@ EOFschedulerinfo # transfer files echo "INFO: `date` - Sending data to storage... ${DIR_SELF}/transfer.sh $JOBDEF_TYPE" | tee -a $JOB_LOGFILE touch "${JOB_DONEFILE}.02.STARTTRANSFER" - ${DIR_SELF}/transfer.sh $JOBDEF_TYPE 2>&1 | tee -a $JOB_LOGFILE + ${DIR_SELF}/transfer.sh $JOBDEF_TYPE $JOBDEF_AUTO 2>&1 | tee -a $JOB_LOGFILE rcTransfer=$? else diff --git a/transfer.sh b/transfer.sh index 9f63e85cc99f1547b316c8727ef63313a942a272..9e9e6e2a95bc013d6dac480730dfc9b86662157f 100755 --- a/transfer.sh +++ b/transfer.sh @@ -164,6 +164,10 @@ if [ "$1" = "full" ]; then METHOD="full" fi + if [ "$1" = "auto" ]; then + METHOD="--full-if-older-than $2" + fi + PASSPHRASE=`_j_getvar ${STORAGEFILE} "gnupg-passphrase"` sParamExclude= @@ -290,10 +294,10 @@ color reset echo - if [ $rc -ne 0 ]; then + if [ $myrc -ne 0 ]; then color error - echo ERROR $rc during file transfer of ${mydir} - case $rc in + echo DIR ERROR ${mydir} rc=$myrc during file transfer + case $myrc in 23) echo A lock file was found. Maybe this server was rebooted while performing a backup. echo If so delete the file lockfile.lock named in the output and start $0 again. ;; @@ -304,7 +308,7 @@ else color ok - echo OK, Transfer of ${mydir} was successful. + echo DIR OK ${mydir} was successful. fi color reset echo @@ -322,7 +326,7 @@ else color error - echo "----- `date` SKIP: $mydir ... does not exist" + echo "DIR SKIP $mydir ... does not exist (no error)" color reset fi echo