diff options
author | Michael Lewkowski <michael@lewkowski.de> | 2016-06-01 07:24:32 +0200 |
---|---|---|
committer | Michael Lewkowski <michael@lewkowski.de> | 2016-06-01 07:24:32 +0200 |
commit | a9c43678db7671a1c575f197299695de446dcee1 (patch) | |
tree | ec34162a572a38c2fe32ec17717ca8058af2afe9 | |
parent | 43b9a53a91f48ebb68c98b9f0c372681462a0ffa (diff) | |
download | munin-a9c43678db7671a1c575f197299695de446dcee1.tar.gz munin-a9c43678db7671a1c575f197299695de446dcee1.tar.bz2 munin-a9c43678db7671a1c575f197299695de446dcee1.tar.xz munin-a9c43678db7671a1c575f197299695de446dcee1.zip |
made smtp auth optional
-rw-r--r-- | start-munin.sh | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/start-munin.sh b/start-munin.sh index c3aa70b..954a112 100644 --- a/start-munin.sh +++ b/start-munin.sh @@ -3,15 +3,23 @@ NODES=${NODES:-} SNMP_NODES=${SNMP_NODES:-} MUNIN_USER=${MUNIN_USER:-user} MUNIN_PASSWORD=${MUNIN_PASSWORD:-password} +MAIL_CONF_PATH='/var/lib/munin/.mailrc' -if [ -n "${SMTP_USERNAME}" -a -n "${SMTP_PASSWORD}" -a -n "${SMTP_HOST}" -a -n "${SMTP_PORT}" ] ; then - cat > /var/lib/munin/.mailrc <<EOF - set smtp-use-starttls - set ssl-verify=ignore - set smtp=smtp://${SMTP_HOST}:${SMTP_PORT} - set smtp-auth=login - set smtp-auth-user=${SMTP_USERNAME} - set smtp-auth-password=${SMTP_PASSWORD} +truncate -s 0 "${MAIL_CONF_PATH}" + +if [ -n "${SMTP_HOST}" -a -n "${SMTP_PORT}" ] ; then + cat >> "${MAIL_CONF_PATH}" <<EOF +set smtp-use-starttls +set ssl-verify=ignore +set smtp=smtp://${SMTP_HOST}:${SMTP_PORT} +EOF +fi + +if [ -n "${SMTP_USERNAME}" -a -n "${SMTP_PASSWORD}" ] ; then + cat >> "${MAIL_CONF_PATH}" <<EOF +set smtp-auth=login +set smtp-auth-user=${SMTP_USERNAME} +set smtp-auth-password=${SMTP_PASSWORD} EOF fi |