diff --git a/README.md b/README.md index 2c66b219a96bafe5a35c8d2f508c4107d82357ba..1249a1acef51c25cedda5705cbe39e955490312b 100644 --- a/README.md +++ b/README.md @@ -91,11 +91,10 @@ then use the **root** user and follow these steps: ### database backup: set local backup target ### -Create a **jobs/dirs.job** (copy the deliverers *.dist file) +Create a **jobs/dirs.job** (copy the delivered *.dist file) cd jobs - cp dirs.job.dist dirs.job - cd .. + cp backup.job.dist backup.job There are 2 defaults: diff --git a/jobhelper.sh b/jobhelper.sh index 08700356d81c8b80af59770dfff7cba28aa71517..5f454780f09678ff98b3ed049a357656b72a0115 100755 --- a/jobhelper.sh +++ b/jobhelper.sh @@ -114,8 +114,8 @@ eofbanner function j_getDirs2Backup(){ STORAGE_SAMBASHARES=`_j_getvar ${STORAGEFILE} "sambashares"` - _j_getvar ${DIRFILE} dir-localdumps - _j_getvar ${DIRFILE} dir-dbarchive + _j_getvar ${JOBFILE} dir-localdumps + _j_getvar ${JOBFILE} dir-dbarchive _j_getvar ${DIRFILE} include # get dirs of filesets, i.e. diff --git a/jobs/backup.job.dist b/jobs/backup.job.dist index 0e4941f429bd2ced78f53345350b65846f6dc5c9..359ea0355a286a00b1feb56ec25916c0cb431e15 100644 --- a/jobs/backup.job.dist +++ b/jobs/backup.job.dist @@ -43,4 +43,17 @@ auto = 1M start-time-inc = 20:00 start-time-full = 20:00 + +# ---------------------------------------------------------------------- +# local dumps; each service has its own subdir there +# this entry is mapped to BACKUP_TARGETDIR in "localdump.sh" +# dir is set by puppet +# ---------------------------------------------------------------------- +dir-localdumps = /var/localdumps/backup +keep-days = 7 + +# archive databases (to keep deleted schemes or databases that +# are not backupped anymore; couchdb2 feature) +dir-dbarchive = /var/localdumps/archive + # ---------------------------------------------------------------------- diff --git a/jobs/dirs.job.dist b/jobs/dirs.job.dist index 5670bd6cf0a82e141a408929e15ebdfd639131ac..c527e3e709499b2bad58c42d0512af4eeb0ba94a 100644 --- a/jobs/dirs.job.dist +++ b/jobs/dirs.job.dist @@ -16,18 +16,6 @@ # ---------------------------------------------------------------------- -# ---------------------------------------------------------------------- -# target directory for local dumps; -# each datbase service has its own subdir there -# this entry is mapped to BACKUP_TARGETDIR in "localdump.sh" -# ---------------------------------------------------------------------- -dir-localdumps = /var/localdumps/backup -keep-days = 7 - -# archive databases (to keep deleted schemes or databases that -# are not backupped anymore; couchdb2 feature) -dir-dbarchive = /var/localdumps/archive - # ---------------------------------------------------------------------- # directory list to transfer # without ending "/" diff --git a/localdump.sh b/localdump.sh index a730d8996aba55d55cb91d6b13478b0eb7611529..de70312b9864c0cc780062c905a6de575ba87bb4 100755 --- a/localdump.sh +++ b/localdump.sh @@ -27,20 +27,27 @@ . ~/.backup.conf fi - BACKUP_BASEDIR=`_j_getvar ${DIRFILE} "dir-localdumps"` + if [ ! -r "${DIRFILE}" ]; then + color error + echo ERROR: missing config file ${DIRFILE}. + color reset + exit 1 + fi + + BACKUP_BASEDIR=`_j_getvar ${JOBFILE} "dir-localdumps"` BACKUP_PLUGINDIR=`dirname $0`/plugins/localdump # check - if [ -z $BACKUP_BASEDIR ]; then + if [ -z "$BACKUP_BASEDIR" ]; then color error echo ERROR: missing config for backup target. - echo There must be an entry dir-localdumps in ${DIRFILE} + echo There must be an entry dir-localdumps in ${JOBFILE} color reset exit 1 fi # CLEANUP AFTER N DAYS... - typeset -i BACKUP_KEEP_DAYS=`_j_getvar ${DIRFILE} "keep-days"` + typeset -i BACKUP_KEEP_DAYS=`_j_getvar ${JOBFILE} "keep-days"` if [ $BACKUP_KEEP_DAYS -eq 0 ]; then BACKUP_KEEP_DAYS = 7 diff --git a/plugins/localdump/readme.md b/plugins/localdump/readme.md index 45a651261cd2e1f30859f88263f690c6dd7f14b9..8e7500856b595f5aef8a335fc3398dceaa9bde0c 100644 --- a/plugins/localdump/readme.md +++ b/plugins/localdump/readme.md @@ -13,7 +13,7 @@ They will be sourced by [APPDIR]/localdump.sh and cannot started directly. (*) If ever possible we use a zero config method. This plugin detects locally installed binaries and running processes of a given name to run a database backup or not. -See settings in `[APPDIR]/jobs/dirs.job`: +See settings in `[APPDIR]/jobs/backup.job`: ```text dir-localdumps = /var/iml-backup diff --git a/transfer.sh b/transfer.sh index e76de8de75ead6bea5f066f25768acc40592c0e2..76bad498fc2002372ae6311ce09b5eb67755b29a 100755 --- a/transfer.sh +++ b/transfer.sh @@ -172,7 +172,7 @@ if [ "$1" = "dumps" ]; then - sDirs2Backup="`_j_getvar ${DIRFILE} dir-localdumps`" + sDirs2Backup="`_j_getvar ${JOBFILE} dir-localdumps`" else sDirs2Backup="`j_getDirs2Backup`" fi