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

skip file backup if config is missing

parent c174b9ee
No related branches found
No related tags found
1 merge request!6skip file backup if config is missing
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# ignored configs # ignored configs
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
jobs/*.job jobs/*.job
keys/*
logs/auto-* logs/auto-*
logs/full-* logs/full-*
logs/inc-* logs/inc-*
......
...@@ -53,30 +53,23 @@ function j_init(){ ...@@ -53,30 +53,23 @@ function j_init(){
j_banner j_banner
if [ ! -d ${DIR_LOGS} ]; then
mkdir -p ${DIR_LOGS} && echo "INFO: dir created ${DIR_LOGS}"
fi
if [ ! -d ${DIR_JOBS} ]; then if [ ! -d ${DIR_JOBS} ]; then
# mkdir -p ${DIR_JOBS} && echo "INFO: dir created ${DIR_JOBS}" # mkdir -p ${DIR_JOBS} && echo "INFO: dir created ${DIR_JOBS}"
echo "ERROR: missing jobs directory. Aborting." echo "ERROR: missing jobs directory. Aborting."
exit 1 exit 1
fi fi
# if transfer.sh exists, then a transfer.job must exist too for myfile in ${JOBFILE} ${DIRFILE} ${STORAGEFILE}
if [ -x "${DIR_SELF}/transfer.sh" ]; then do
ls ${STORAGEFILE} >/dev/null if [ ! -f "${myfile}" ]; then
if [ $? -ne 0 ]; then echo "WARNING: missing a config file: $myfile"
echo "ERROR: missing a config file in ${DIR_JOBS}" # exit 1
exit 1
fi fi
fi done
if [ ! -d ${DIR_LOGS} ]; then
mkdir -p ${DIR_LOGS} && echo "INFO: dir created ${DIR_LOGS}"
fi
ls ${JOBFILE} ${DIRFILE} >/dev/null
if [ $? -ne 0 ]; then
echo "ERROR: missing a config file in ${DIR_JOBS}"
exit 1
fi
# for date definitions like weekdays # for date definitions like weekdays
JOBDEF_LANG=`_j_getvar ${JOBFILE} "lang"` JOBDEF_LANG=`_j_getvar ${JOBFILE} "lang"`
......
...@@ -38,7 +38,10 @@ ...@@ -38,7 +38,10 @@
. `dirname $0`/jobhelper.sh . `dirname $0`/jobhelper.sh
. `dirname $0`/inc_bash.sh . `dirname $0`/inc_bash.sh
typeset -i rc=0 typeset -i rc=0
if [ ! -r "${DIRFILE}" -o ! -r "${STORAGEFILE}" ]; then
echo "SKIP backup of local files - one of the files is not readable (no error): ${DIRFILE} | ${STORAGEFILE}"
fi
STORAGE_BIN=`_j_getvar ${STORAGEFILE} "bin"` STORAGE_BIN=`_j_getvar ${STORAGEFILE} "bin"`
STORAGE_BASEDIR=`_j_getvar ${STORAGEFILE} "storage"` STORAGE_BASEDIR=`_j_getvar ${STORAGEFILE} "storage"`
...@@ -266,7 +269,7 @@ ...@@ -266,7 +269,7 @@
# --- backup # --- backup
h3 "`date` Backup ${mydir}" h3 "`date` Backup ${mydir}"
sCmd="$( t_backupDirGetCmdBackup)" sCmd="$( t_backupDirGetCmdBackup )"
echo "what: ${mydir}" echo "what: ${mydir}"
echo "target: ${sTarget}" echo "target: ${sTarget}"
echo "command: $sCmd" echo "command: $sCmd"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment