From d1c5de13de4deb8324ec320ee58a3f7c4fe0ef97 Mon Sep 17 00:00:00 2001 From: deajan Date: Mon, 30 Nov 2015 14:49:19 +0100 Subject: [PATCH] Fixed subject in sendmail --- dev/debug_obackup.sh | 9 ++++----- dev/ofunctions.sh | 6 +++--- obackup.sh | 9 ++++----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/dev/debug_obackup.sh b/dev/debug_obackup.sh index f54816d..7e7f37e 100755 --- a/dev/debug_obackup.sh +++ b/dev/debug_obackup.sh @@ -9,7 +9,7 @@ PROGRAM_VERSION=2.0-pre PROGRAM_BUILD=2015112802 IS_STABLE=no -FUNC_BUILD=2015111901 +FUNC_BUILD=2015113001 ## BEGIN Generic functions for osync & obackup written in 2013-2015 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode @@ -85,7 +85,6 @@ function Dummy { sleep .1 } -#__FUNC:Logger function _Logger { local svalue="${1}" # What to log to screen local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value @@ -138,7 +137,6 @@ function Logger { _Logger "$prefix$value" fi } -#__ENDFUNC # Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X function KillChilds { @@ -271,7 +269,6 @@ function SendAlert { subject="Alert for $INSTANCE_ID" fi - # Need better fallback if mail sending does not succeed if type mutt > /dev/null 2>&1 ; then echo "$MAIL_ALERT_MSG" | $(type -p mutt) -x -s "$subject" $DESTINATION_MAILS -a "$ALERT_LOG_FILE" if [ $? != 0 ]; then @@ -300,7 +297,7 @@ function SendAlert { fi if type sendmail > /dev/null 2>&1 ; then - echo -e "$subject\r\n$MAIL_ALERT_MSG" | $(type -p sendmail) $DESTINATION_MAILS + echo -e "Subject:$subject\r\n$MAIL_ALERT_MSG" | $(type -p sendmail) $DESTINATION_MAILS if [ $? != 0 ]; then Logger "WARNING: Cannot send alert email via $(type -p sendmail) !!!" "WARN" else @@ -349,6 +346,8 @@ function LoadConfigFile { # Shellcheck source=./sync.conf source "$RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID" fi + + CONFIG_FILE="$config_file" } function GetLocalOS { diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index bbdac34..51f254b 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -1,4 +1,4 @@ -FUNC_BUILD=2015112801 +FUNC_BUILD=2015113001 ## BEGIN Generic functions for osync & obackup written in 2013-2015 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode @@ -249,7 +249,7 @@ function SendAlert { # eval "cat \"$LOG_FILE\" $COMPRESSION_PROGRAM > $ALERT_LOG_FILE" - MAIL_ALERT_MSG="$MAIL_ALERT_MSG"$'\n\n'$(tail -n 25 "$LOG_FILE") + MAIL_ALERT_MSG="$MAIL_ALERT_MSG"$'\n\n'$(tail -n 50 "$LOG_FILE") if [ $ERROR_ALERT -eq 1 ]; then subject="Error alert for $INSTANCE_ID" elif [ $WARN_ALERT -eq 1 ]; then @@ -286,7 +286,7 @@ function SendAlert { fi if type sendmail > /dev/null 2>&1 ; then - echo -e "$subject\r\n$MAIL_ALERT_MSG" | $(type -p sendmail) $DESTINATION_MAILS + echo -e "Subject:$subject\r\n$MAIL_ALERT_MSG" | $(type -p sendmail) $DESTINATION_MAILS if [ $? != 0 ]; then Logger "WARNING: Cannot send alert email via $(type -p sendmail) !!!" "WARN" else diff --git a/obackup.sh b/obackup.sh index 38559df..9c8d315 100755 --- a/obackup.sh +++ b/obackup.sh @@ -9,7 +9,7 @@ PROGRAM_VERSION=2.0-pre PROGRAM_BUILD=2015112802 IS_STABLE=no -FUNC_BUILD=2015111901 +FUNC_BUILD=2015113001 ## BEGIN Generic functions for osync & obackup written in 2013-2015 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode @@ -80,7 +80,6 @@ function Dummy { sleep .1 } -#__FUNC:Logger function _Logger { local svalue="${1}" # What to log to screen local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value @@ -128,7 +127,6 @@ function Logger { _Logger "$prefix$value" fi } -#__ENDFUNC # Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X function KillChilds { @@ -259,7 +257,6 @@ function SendAlert { subject="Alert for $INSTANCE_ID" fi - # Need better fallback if mail sending does not succeed if type mutt > /dev/null 2>&1 ; then echo "$MAIL_ALERT_MSG" | $(type -p mutt) -x -s "$subject" $DESTINATION_MAILS -a "$ALERT_LOG_FILE" if [ $? != 0 ]; then @@ -288,7 +285,7 @@ function SendAlert { fi if type sendmail > /dev/null 2>&1 ; then - echo -e "$subject\r\n$MAIL_ALERT_MSG" | $(type -p sendmail) $DESTINATION_MAILS + echo -e "Subject:$subject\r\n$MAIL_ALERT_MSG" | $(type -p sendmail) $DESTINATION_MAILS if [ $? != 0 ]; then Logger "WARNING: Cannot send alert email via $(type -p sendmail) !!!" "WARN" else @@ -336,6 +333,8 @@ function LoadConfigFile { # Shellcheck source=./sync.conf source "$RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID" fi + + CONFIG_FILE="$config_file" } function GetLocalOS {