diff --git a/backup.sh b/backup.sh index f3c4f69ac58deb86822a32cd03fb67b1a0f29dc5..75fed165f6d7da93a19935e216778a1386d66c04 100755 --- a/backup.sh +++ b/backup.sh @@ -13,6 +13,7 @@ # ah - Axel Hahn <axel.hahn@iml.unibe.ch> # # 2022-01-14 ah v1.0 +# 2022-02-10 ah v1.1 handle local dumps only; improve infos # ================================================================================ . $( dirname "$0" )/jobhelper.sh @@ -125,17 +126,28 @@ EOFhelp # show infos # -------------------------------------------------------------------------------- - cfg_type=$(_j_getvar "${STORAGEFILE}" "type") - cfg_full=$(_j_getvar "${STORAGEFILE}" "full") - cfg_startfull=$(_j_getvar "${STORAGEFILE}" "start-time-full") + # TODO: + # check localdump plugins ... what database types are detected + + # --- infos for transfer - 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]" - JOBDEF_STARTTIME=$(date +%H%M) - STORAGE_BIN=$( _j_getvar "${STORAGEFILE}" "bin" ) STORAGE_BASEDIR=$(_j_getvar "${STORAGEFILE}" "storage") - cat << EOFbackupinfo + if [ -z "$STORAGE_BASEDIR" ]; then + echo "INFO: no value for backup target (in storage = ...)" + echo "This is not handled as an error. I will run local backup dumps only; no transfer." + else + STORAGE_BIN=$( _j_getvar "${STORAGEFILE}" "bin" ) + 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]" + + JOBDEF_STARTTIME=$(date +%H%M) + + cat << EOFbackupinfo CONFIG: Used Backup tool : $STORAGE_BIN @@ -146,22 +158,22 @@ EOFhelp type : $JOBDEF_TYPE $JOBDEF_AUTO log : $JOB_LOGFILE - target : ${STORAGE_BASEDIR}$( test -z "$STORAGE_BASEDIR" && echo "NONE (local backup dumps only; no transfer)") + target : ${STORAGE_BASEDIR} EOFbackupinfo - - test -z "$STORAGE_BASEDIR" || ( - echo " dirs to transfer : " - j_getDirs2Backup | sed "s#^# #g" - echo - ) - - j_requireUser "root" + test -z "$STORAGE_BASEDIR" || ( + echo " dirs to transfer : " + j_getDirs2Backup | sed "s#^# #g" + ) + fi + echo # -------------------------------------------------------------------------------- # start backup # -------------------------------------------------------------------------------- + j_requireUser "root" + if [ $bStart -eq 1 ]; then sleep 3