Added pfSense mail support and fixed FreeBSD install.sh

pull/48/merge
deajan 8 years ago
parent 3a988bbfb7
commit b4f4a122c8

@ -11,7 +11,7 @@ PROGRAM_VERSION=1.1-dev
PROGRAM_BUILD=2016031002
IS_STABLE=no
## FUNC_BUILD=2016032002
## FUNC_BUILD=2016032201
## BEGIN Generic functions for osync & obackup written in 2013-2016 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
@ -170,6 +170,7 @@ function SendAlert {
local mail_no_attachment=
local attachment_command=
local subject=
if [ "$DESTINATION_MAILS" == "" ]; then
return 0
@ -273,8 +274,21 @@ function SendAlert {
fi
fi
# pfSense specific
if [ -f /usr/local/bin/mail.php ]; then
cmd="echo \"$MAIL_ALERT_MSG\" | /usr/local/bin/mail.php subject=\"$subject\""
Logger "Mail cmd: $cmd" "DEBUG"
eval $cmd
if [ $? != 0 ]; then
Logger "Cannot send alert email via /usr/local/bin/mail.php (pfsense) !!!" "WARN"
else
Logger "Sent alert mail using pfSense mail.php." "NOTICE"
return 0
fi
fi
# If function has not returned 0 yet, assume it's critical that no alert can be sent
Logger "Cannot send alert (neither mutt, mail, sendmail nor sendemail found)." "ERROR" # Is not marked critical because execution must continue
Logger "Cannot send alert (neither mutt, mail, sendmail, sendemail or pfSense mail.php found)." "ERROR" # Is not marked critical because execution must continue
# Delete tmp log file
if [ -f "$ALERT_LOG_FILE" ]; then

@ -1,4 +1,4 @@
## FUNC_BUILD=2016032002
## FUNC_BUILD=2016032201
## BEGIN Generic functions for osync & obackup written in 2013-2016 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
@ -157,6 +157,7 @@ function SendAlert {
local mail_no_attachment=
local attachment_command=
local subject=
if [ "$DESTINATION_MAILS" == "" ]; then
return 0
@ -260,8 +261,21 @@ function SendAlert {
fi
fi
# pfSense specific
if [ -f /usr/local/bin/mail.php ]; then
cmd="echo \"$MAIL_ALERT_MSG\" | /usr/local/bin/mail.php subject=\"$subject\""
Logger "Mail cmd: $cmd" "DEBUG"
eval $cmd
if [ $? != 0 ]; then
Logger "Cannot send alert email via /usr/local/bin/mail.php (pfsense) !!!" "WARN"
else
Logger "Sent alert mail using pfSense mail.php." "NOTICE"
return 0
fi
fi
# If function has not returned 0 yet, assume it's critical that no alert can be sent
Logger "Cannot send alert (neither mutt, mail, sendmail nor sendemail found)." "ERROR" # Is not marked critical because execution must continue
Logger "Cannot send alert (neither mutt, mail, sendmail, sendemail or pfSense mail.php found)." "ERROR" # Is not marked critical because execution must continue
# Delete tmp log file
if [ -f "$ALERT_LOG_FILE" ]; then

@ -11,7 +11,7 @@ PROGRAM_VERSION=1.1-dev
PROGRAM_BUILD=2016031002
IS_STABLE=no
## FUNC_BUILD=2016032002
## FUNC_BUILD=2016032201
## BEGIN Generic functions for osync & obackup written in 2013-2016 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
@ -159,6 +159,7 @@ function SendAlert {
local mail_no_attachment=
local attachment_command=
local subject=
if [ "$DESTINATION_MAILS" == "" ]; then
return 0
@ -262,8 +263,21 @@ function SendAlert {
fi
fi
# pfSense specific
if [ -f /usr/local/bin/mail.php ]; then
cmd="echo \"$MAIL_ALERT_MSG\" | /usr/local/bin/mail.php subject=\"$subject\""
Logger "Mail cmd: $cmd" "DEBUG"
eval $cmd
if [ $? != 0 ]; then
Logger "Cannot send alert email via /usr/local/bin/mail.php (pfsense) !!!" "WARN"
else
Logger "Sent alert mail using pfSense mail.php." "NOTICE"
return 0
fi
fi
# If function has not returned 0 yet, assume it's critical that no alert can be sent
Logger "Cannot send alert (neither mutt, mail, sendmail nor sendemail found)." "ERROR" # Is not marked critical because execution must continue
Logger "Cannot send alert (neither mutt, mail, sendmail, sendemail or pfSense mail.php found)." "ERROR" # Is not marked critical because execution must continue
# Delete tmp log file
if [ -f "$ALERT_LOG_FILE" ]; then

Loading…
Cancel
Save