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

backup add -o; move cfg var

parent 068e354d
No related branches found
No related tags found
1 merge request!26Eliminate scheduler
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment