diff --git a/CHANGELOG.md b/CHANGELOG.md index 54fec08..0c9058a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### dd Mmm YYYY: osync v1.3 release (for full changelog since v1.2 branch see all v1.3-beta/RC entries) +- New options ALWAYS_SEND_MAILS to allow sending logs regardless of execution states + ### 29 June 2020: osync v1.3-RC1 release - New option to use SSH_CONTROLMASTER in order to speed up remote sync tasks and preserve a single ssh channel diff --git a/dev/n_osync.sh b/dev/n_osync.sh index 2e584e0..7502de2 100644 --- a/dev/n_osync.sh +++ b/dev/n_osync.sh @@ -4,10 +4,10 @@ #Check dryruns with nosuffix mode for timestampList PROGRAM="osync" # Rsync based two way sync engine with fault tolerance -AUTHOR="(C) 2013-2020 by Orsiris de Jong" +AUTHOR="(C) 2013-2021 by Orsiris de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" PROGRAM_VERSION=1.3.0-rc1 -PROGRAM_BUILD=2020111501 +PROGRAM_BUILD=2021062901 IS_STABLE=false CONFIG_FILE_REVISION_REQUIRED=1.3.0 @@ -109,6 +109,10 @@ function TrapQuit { UnlockReplicas RunAfterHook Logger "$PROGRAM finished." "ALWAYS" + if [ $ALWAYS_SEND_MAILS == true ]; + then + SendAlert + fi exitcode=0 fi CleanUp @@ -3195,6 +3199,11 @@ if [ $_QUICK_SYNC -eq 2 ]; then if [ $(IsInteger "$MIN_WAIT") -ne 1 ]; then MIN_WAIT=30 fi + + if [ "$ALWAYS_SEND_MAILS" == "" ]; then + ALWAYS_SEND_MAILS=false + fi + # First character shouldn't be '-' when config file given elif [ "${1:0:1}" != "-" ]; then ConfigFile="${1}" diff --git a/sync.conf.example b/sync.conf.example index f85388b..3cfa550 100644 --- a/sync.conf.example +++ b/sync.conf.example @@ -1,5 +1,5 @@ ###### osync - Rsync based two way sync engine with fault tolerance -###### (C) 2013-2020 by Orsiris de Jong (www.netpower.fr) +###### (C) 2013-2021 by Orsiris de Jong (www.netpower.fr) [GENERAL] CONFIG_FILE_REVISION=1.3.0 @@ -179,13 +179,15 @@ PARTIAL=false DELTA_COPIES=true [ALERT_OPTIONS] - ## List of alert mails separated by spaces ## Most Unix systems (including Win10 bash) have mail support out of the box ## Just make sure that the current user has enough privileges to use mail / mutt / sendmail and that the mail system is configured to allow outgoing mails ## on pfSense platform, smtp support needs to be configured in System > Advanced > Notifications DESTINATION_MAILS="your@alert.tld" +## By default, only sync warnings / errors are sent by mail. This default behavior can be overrided here +ALWAYS_SEND_MAILS=false + ## Optional change of mail body encoding (using iconv) ## By default, all mails are sent in UTF-8 format without header (because of maximum compatibility of all platforms) ## You may specify an optional encoding here (like "ISO-8859-1" or whatever iconv can handle)