Fixed subject in sendmail
This commit is contained in:
parent
c51908bc83
commit
941bf5bf08
|
@ -7,7 +7,7 @@ PROGRAM_VERSION=1.1-pre
|
||||||
PROGRAM_BUILD=2015112805
|
PROGRAM_BUILD=2015112805
|
||||||
IS_STABLE=no
|
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
|
## 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
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
|
@ -83,7 +83,6 @@ function Dummy {
|
||||||
sleep .1
|
sleep .1
|
||||||
}
|
}
|
||||||
|
|
||||||
#__FUNC:Logger
|
|
||||||
function _Logger {
|
function _Logger {
|
||||||
local svalue="${1}" # What to log to screen
|
local svalue="${1}" # What to log to screen
|
||||||
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
||||||
|
@ -136,7 +135,6 @@ function Logger {
|
||||||
_Logger "$prefix$value"
|
_Logger "$prefix$value"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
#__ENDFUNC
|
|
||||||
|
|
||||||
# Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X
|
# Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X
|
||||||
function KillChilds {
|
function KillChilds {
|
||||||
|
@ -269,7 +267,6 @@ function SendAlert {
|
||||||
subject="Alert for $INSTANCE_ID"
|
subject="Alert for $INSTANCE_ID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Need better fallback if mail sending does not succeed
|
|
||||||
if type mutt > /dev/null 2>&1 ; then
|
if type mutt > /dev/null 2>&1 ; then
|
||||||
echo "$MAIL_ALERT_MSG" | $(type -p mutt) -x -s "$subject" $DESTINATION_MAILS -a "$ALERT_LOG_FILE"
|
echo "$MAIL_ALERT_MSG" | $(type -p mutt) -x -s "$subject" $DESTINATION_MAILS -a "$ALERT_LOG_FILE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
|
@ -298,7 +295,7 @@ function SendAlert {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type sendmail > /dev/null 2>&1 ; then
|
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
|
if [ $? != 0 ]; then
|
||||||
Logger "WARNING: Cannot send alert email via $(type -p sendmail) !!!" "WARN"
|
Logger "WARNING: Cannot send alert email via $(type -p sendmail) !!!" "WARN"
|
||||||
else
|
else
|
||||||
|
@ -347,6 +344,8 @@ function LoadConfigFile {
|
||||||
# Shellcheck source=./sync.conf
|
# Shellcheck source=./sync.conf
|
||||||
source "$RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID"
|
source "$RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CONFIG_FILE="$config_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetLocalOS {
|
function GetLocalOS {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FUNC_BUILD=2015112802
|
FUNC_BUILD=2015113001
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2015 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## 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
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
|
@ -286,7 +286,7 @@ function SendAlert {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type sendmail > /dev/null 2>&1 ; then
|
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
|
if [ $? != 0 ]; then
|
||||||
Logger "WARNING: Cannot send alert email via $(type -p sendmail) !!!" "WARN"
|
Logger "WARNING: Cannot send alert email via $(type -p sendmail) !!!" "WARN"
|
||||||
else
|
else
|
||||||
|
|
9
osync.sh
9
osync.sh
|
@ -7,7 +7,7 @@ PROGRAM_VERSION=1.1-pre
|
||||||
PROGRAM_BUILD=2015112805
|
PROGRAM_BUILD=2015112805
|
||||||
IS_STABLE=no
|
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
|
## 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
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
|
@ -78,7 +78,6 @@ function Dummy {
|
||||||
sleep .1
|
sleep .1
|
||||||
}
|
}
|
||||||
|
|
||||||
#__FUNC:Logger
|
|
||||||
function _Logger {
|
function _Logger {
|
||||||
local svalue="${1}" # What to log to screen
|
local svalue="${1}" # What to log to screen
|
||||||
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
||||||
|
@ -126,7 +125,6 @@ function Logger {
|
||||||
_Logger "$prefix$value"
|
_Logger "$prefix$value"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
#__ENDFUNC
|
|
||||||
|
|
||||||
# Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X
|
# Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X
|
||||||
function KillChilds {
|
function KillChilds {
|
||||||
|
@ -257,7 +255,6 @@ function SendAlert {
|
||||||
subject="Alert for $INSTANCE_ID"
|
subject="Alert for $INSTANCE_ID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Need better fallback if mail sending does not succeed
|
|
||||||
if type mutt > /dev/null 2>&1 ; then
|
if type mutt > /dev/null 2>&1 ; then
|
||||||
echo "$MAIL_ALERT_MSG" | $(type -p mutt) -x -s "$subject" $DESTINATION_MAILS -a "$ALERT_LOG_FILE"
|
echo "$MAIL_ALERT_MSG" | $(type -p mutt) -x -s "$subject" $DESTINATION_MAILS -a "$ALERT_LOG_FILE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
|
@ -286,7 +283,7 @@ function SendAlert {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type sendmail > /dev/null 2>&1 ; then
|
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
|
if [ $? != 0 ]; then
|
||||||
Logger "WARNING: Cannot send alert email via $(type -p sendmail) !!!" "WARN"
|
Logger "WARNING: Cannot send alert email via $(type -p sendmail) !!!" "WARN"
|
||||||
else
|
else
|
||||||
|
@ -334,6 +331,8 @@ function LoadConfigFile {
|
||||||
# Shellcheck source=./sync.conf
|
# Shellcheck source=./sync.conf
|
||||||
source "$RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID"
|
source "$RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CONFIG_FILE="$config_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetLocalOS {
|
function GetLocalOS {
|
||||||
|
|
Loading…
Reference in New Issue