Skip to content
Snippets Groups Projects
Commit 04998e6f authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add backup type auto; updates and fixes in output

parent 77729dad
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
# ignored configs
# ----------------------------------------------------------------------
jobs/*.job
logs/auto-*
logs/full-*
logs/inc-*
logs/transfer-*
......
......@@ -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
......
......@@ -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`
......
......@@ -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
......
......@@ -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
;;
*)
......
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment