diff --git a/backup.sh b/backup.sh index 77bbe95b4e6173022512dd104a1aaf80d12a5a34..e4bcfabdf07088b08d95c4d46b979e7aa01ab959 100755 --- a/backup.sh +++ b/backup.sh @@ -35,7 +35,7 @@ START A BACKUP This script starts - the database backups and creates dumps locally - - the file backup (using restic or dupliciity) + - the file backup (using restic or duplicity) SYNTAX: @@ -49,8 +49,9 @@ OPTIONS: -h, --help Show this help The following parameters force the backup type (if using duplicity): - -a, --auto force auto (repeat full backup if last full backup is older than ...) - This parameter requires a value like "1M" for 1 month + -a, --auto force auto + -o, --older duplicity type=auto: repeat full backup if last full + backup is older than ... like "1M" for 1 month -f, --full force full backup (if supported) -i, --inc force incrmenental backup @@ -82,7 +83,12 @@ do bStart=0 ;; -a|--auto) - echo "Param: setting to AUTO $2" + echo "Param: setting to AUTO" + JOBDEF_TYPE=auto + bStart=1 + ;; + -o|--older) + echo "Param: setting to AUTO on duplicity" echo "$2" | grep "^[1-9][0-9]*[a-zA-Z]$" 2>/dev/null if [ $? -ne 0 ]; then echo "ERROR: the value after $1 must be a number and a letter (for unit); i.e. 1M for 1 month" @@ -90,10 +96,8 @@ do else JOBDEF_TYPE=auto JOBDEF_AUTO=$2 - bStart=1 shift 1 fi - ;; -f|--full) echo "Param: setting to FULL" @@ -120,9 +124,9 @@ do _j_setLogfile # show infos - cfg_type=$(_j_getvar "${JOBFILE}" "type") - cfg_full=$(_j_getvar "${JOBFILE}" "full") - cfg_startfull=$(_j_getvar "${JOBFILE}" "start-time-full") + cfg_type=$(_j_getvar "${STORAGEFILE}" "type") + cfg_full=$(_j_getvar "${STORAGEFILE}" "full") + cfg_startfull=$(_j_getvar "${STORAGEFILE}" "start-time-full") test -z "${cfg_full}${cfg_startfull}" || cfg_info="INFO: Type is [auto]; ignoring config for full backup: [full = $cfg_full ... start-time-full = $cfg_startfull]" @@ -133,7 +137,7 @@ do CONFIG: Used Backup tool : $STORAGE_BIN - Backup type : $(_j_getvar ${JOBFILE} "type") + Backup type : $(_j_getvar ${STORAGEFILE} "type") $( test "$cfg_type" = "auto" && echo "$cfg_info" )$( test "$cfg_type" = "auto" || echo "INFO: full backup: $cfg_info" ) EFFECTIVE: @@ -172,6 +176,7 @@ EOFbackupinfo if [ -x "${DIR_SELF}/transfer.sh" ]; then # transfer files + cat "$STORAGEFILE" >>"$JOB_LOGFILE" 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 "$JOBDEF_AUTO" 2>&1 | tee -a "$JOB_LOGFILE"