More fixes for GNU / non-GNU versions of mail command

pull/48/merge
deajan 9 years ago
parent 941bf5bf08
commit 9fda36adb7

@ -8,11 +8,14 @@ KNOWN ISSUES
------------
- Cannot finish sync if one replica contains a directory and the other replica contains a file named the same way (Unix doesn't allow this)
- Soft deletion does not honor exclusion lists
RECENT CHANGES
--------------
! XX Dec 2015: osync v1.1 released
- More fixes for GNU / non-GNU versions of mail command
- Added bogus config file checks & environment checks
- Added delta copies disable option
- Revamped rsync patterns to allow include and exclude patterns

@ -7,7 +7,7 @@ PROGRAM_VERSION=1.1-pre
PROGRAM_BUILD=2015112805
IS_STABLE=no
FUNC_BUILD=2015113001
FUNC_BUILD=2015121501
## 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
@ -278,7 +278,13 @@ function SendAlert {
fi
if type mail > /dev/null 2>&1 ; then
echo "$MAIL_ALERT_MSG" | $(type -p mail) -a "$ALERT_LOG_FILE" -s "$subject" $DESTINATION_MAILS
if $(type -p mail) -V | grep "GNU" > /dev/null; then echo ok; fi
attachment_command="-A $ALERT_LOG_FILE"
elif ($type -p mail) -V; then
attachment_command="-a $ALERT_LOG_FILE"
else
attachment_command=""
echo "$MAIL_ALERT_MSG" | $(type -p mail) $attachment_command -s "$subject" $DESTINATION_MAILS
if [ $? != 0 ]; then
Logger "WARNING: Cannot send alert email via $(type -p mail) with attachments !!!" "WARN"
echo "$MAIL_ALERT_MSG" | $(type -p mail) -s "$subject" $DESTINATION_MAILS

@ -1,4 +1,4 @@
FUNC_BUILD=2015113001
FUNC_BUILD=2015121501
## 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
@ -269,7 +269,13 @@ function SendAlert {
fi
if type mail > /dev/null 2>&1 ; then
echo "$MAIL_ALERT_MSG" | $(type -p mail) -a "$ALERT_LOG_FILE" -s "$subject" $DESTINATION_MAILS
if $(type -p mail) -V | grep "GNU" > /dev/null; then echo ok; fi
attachment_command="-A $ALERT_LOG_FILE"
elif ($type -p mail) -V; then
attachment_command="-a $ALERT_LOG_FILE"
else
attachment_command=""
echo "$MAIL_ALERT_MSG" | $(type -p mail) $attachment_command -s "$subject" $DESTINATION_MAILS
if [ $? != 0 ]; then
Logger "WARNING: Cannot send alert email via $(type -p mail) with attachments !!!" "WARN"
echo "$MAIL_ALERT_MSG" | $(type -p mail) -s "$subject" $DESTINATION_MAILS

@ -7,7 +7,7 @@ PROGRAM_VERSION=1.1-pre
PROGRAM_BUILD=2015112805
IS_STABLE=no
FUNC_BUILD=2015113001
FUNC_BUILD=2015121501
## 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
@ -266,7 +266,13 @@ function SendAlert {
fi
if type mail > /dev/null 2>&1 ; then
echo "$MAIL_ALERT_MSG" | $(type -p mail) -a "$ALERT_LOG_FILE" -s "$subject" $DESTINATION_MAILS
if $(type -p mail) -V | grep "GNU" > /dev/null; then echo ok; fi
attachment_command="-A $ALERT_LOG_FILE"
elif ($type -p mail) -V; then
attachment_command="-a $ALERT_LOG_FILE"
else
attachment_command=""
echo "$MAIL_ALERT_MSG" | $(type -p mail) $attachment_command -s "$subject" $DESTINATION_MAILS
if [ $? != 0 ]; then
Logger "WARNING: Cannot send alert email via $(type -p mail) with attachments !!!" "WARN"
echo "$MAIL_ALERT_MSG" | $(type -p mail) -s "$subject" $DESTINATION_MAILS

Loading…
Cancel
Save