From 71cd801c198dc6b0b186a12aa310549f6c538863 Mon Sep 17 00:00:00 2001 From: Dave lane Date: Mon, 12 Feb 2018 11:14:38 +1300 Subject: [PATCH] no more emails for hourly backups, don't run if no task is specified --- dbbackup-docker-compose | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dbbackup-docker-compose b/dbbackup-docker-compose index 1d5cc13..e9ec0c2 100755 --- a/dbbackup-docker-compose +++ b/dbbackup-docker-compose @@ -146,7 +146,8 @@ do_backup() { verbose "doing database dump: $CMD" $CMD >> $FILE } - +# +TASK= # # cycle through the command line options while test $# -ne 0 ; do @@ -179,10 +180,18 @@ while test $# -ne 0 ; do esac shift done +# +# we must have *some* task specified +if [[ $TASK == '' ]] ; then + message "No TASK specified! Pick --hourly, --daily, --weekly, --monthly, --yearly..." + exit 1 +fi # # # create the blank email report -create_tmp_email +if ! [[ $TASK == 'HOURLY' ]] ; then + create_tmp_email +fi # if test -f $MAIN_DIR/$BU_CONF ; then verbose "Reading default in $MAIN_DIR/$BU_CONF" @@ -227,5 +236,7 @@ cd $OLD_DIR # # sent resulting email report # -send_email_report $TASK +if ! [[ $TASK == 'HOURLY' ]] ; then + send_email_report $TASK +fi exit 0