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
Branches
No related tags found
1 merge request!26Eliminate scheduler
...@@ -35,7 +35,7 @@ START A BACKUP ...@@ -35,7 +35,7 @@ START A BACKUP
This script starts This script starts
- the database backups and creates dumps locally - the database backups and creates dumps locally
- the file backup (using restic or dupliciity) - the file backup (using restic or duplicity)
SYNTAX: SYNTAX:
...@@ -49,8 +49,9 @@ OPTIONS: ...@@ -49,8 +49,9 @@ OPTIONS:
-h, --help Show this help -h, --help Show this help
The following parameters force the backup type (if using duplicity): The following parameters force the backup type (if using duplicity):
-a, --auto force auto (repeat full backup if last full backup is older than ...) -a, --auto force auto
This parameter requires a value like "1M" for 1 month -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) -f, --full force full backup (if supported)
-i, --inc force incrmenental backup -i, --inc force incrmenental backup
...@@ -82,7 +83,12 @@ do ...@@ -82,7 +83,12 @@ do
bStart=0 bStart=0
;; ;;
-a|--auto) -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 echo "$2" | grep "^[1-9][0-9]*[a-zA-Z]$" 2>/dev/null
if [ $? -ne 0 ]; then 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" 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 ...@@ -90,10 +96,8 @@ do
else else
JOBDEF_TYPE=auto JOBDEF_TYPE=auto
JOBDEF_AUTO=$2 JOBDEF_AUTO=$2
bStart=1
shift 1 shift 1
fi fi
;; ;;
-f|--full) -f|--full)
echo "Param: setting to FULL" echo "Param: setting to FULL"
...@@ -120,9 +124,9 @@ do ...@@ -120,9 +124,9 @@ do
_j_setLogfile _j_setLogfile
# show infos # show infos
cfg_type=$(_j_getvar "${JOBFILE}" "type") cfg_type=$(_j_getvar "${STORAGEFILE}" "type")
cfg_full=$(_j_getvar "${JOBFILE}" "full") cfg_full=$(_j_getvar "${STORAGEFILE}" "full")
cfg_startfull=$(_j_getvar "${JOBFILE}" "start-time-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]" 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 ...@@ -133,7 +137,7 @@ do
CONFIG: CONFIG:
Used Backup tool : $STORAGE_BIN 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" ) $( test "$cfg_type" = "auto" && echo "$cfg_info" )$( test "$cfg_type" = "auto" || echo "INFO: full backup: $cfg_info" )
EFFECTIVE: EFFECTIVE:
...@@ -172,6 +176,7 @@ EOFbackupinfo ...@@ -172,6 +176,7 @@ EOFbackupinfo
if [ -x "${DIR_SELF}/transfer.sh" ]; then if [ -x "${DIR_SELF}/transfer.sh" ]; then
# transfer files # transfer files
cat "$STORAGEFILE" >>"$JOB_LOGFILE"
echo "INFO: $(date) - Sending data to storage... ${DIR_SELF}/transfer.sh $JOBDEF_TYPE" | tee -a "$JOB_LOGFILE" echo "INFO: $(date) - Sending data to storage... ${DIR_SELF}/transfer.sh $JOBDEF_TYPE" | tee -a "$JOB_LOGFILE"
touch "${JOB_DONEFILE}.02.STARTTRANSFER" touch "${JOB_DONEFILE}.02.STARTTRANSFER"
"${DIR_SELF}"/transfer.sh $JOBDEF_TYPE "$JOBDEF_AUTO" 2>&1 | tee -a "$JOB_LOGFILE" "${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