Ciao Bello!
i wrote:
|SZÉPE Viktor wrote:
...
||s-nail is very popular, it is included in my Debian server deployment \
||script!
||https://github.com/szepeviktor/debian-server-tools/blob/master/debian-setup\
||2\
||.sh#L41
While looking some more, i have some suggestions for possible
improvements, just in case i understand your concerns right.
In monitoring/init-alert/debian/init-alert.init there is
| s-nail -s "Host is BOOTED: $(hostname -f)" ${INIT_ALERT_MAIL}; then
# Wait for message delivery
sleep 5
return 0
and the same a few lines below for halting. If that sleep is
meant for s-nail rather than the underlaying MTA? Then you could
remove it by simply using "s-nail -Ssendwait", in which case we
would wait for the exit of the MTA.
Even more please note that if run like that s-nail will read
/etc/s-nail.rc (or what is it in Debian?) as well the invoking
users ~/mail.rc. You possibly want to use -:/ (new in v14.9
series) and set only those variables you want via -S.
Hmm, ok. In monitoring/domain-expiry.sh ;) you say
s-nail -E -S from="${DAEMON} <root>" -s "domain expiry alert" root
which should complain about an invalid address. How about
s-nail -ESfrom="${DAEMON}@${HOSTNAME}" -s"domain expiry alert" root
or even
s-nail -Er "${DAEMON}@${HOSTNAME}" -s"domain expiry alert" root
but of course the latter will pass -f to the MTA?
The same problem in monitoring/smart-zeros.sh: "<root>" is not
a valid address! Ditto, monitoring/ssh-watch.sh.
In monitoring/cse/can-send-email.sh, ohwowwow! Despite said
address errors there is:
s-nail -s "[cse] bounce message / Email kézbesítés monitorozás" \
-S "from=${CSE_ADDRESS}" -- "$RECIPIENT" "-f${CSE_ADDRESS}" \
|| echo "Trigger failed ($?) for ${URL}"
No recipient specified, and MTA arguments after -- are simply
ignored unless -Sexpandargv is set! Also the "|| trigger failed"
will not work the way you want unless *sendwait* is set.
Here i thus would vote for
LC_ALL=C s-nail -:/ -Ssendwait -Sttycharset=utf8 \
-s "[cse] bounce message / Hüh-hüpf" \
-r "${CSE_ADDRESS}" "$RECIPIENT" \
|| echo "Trigger failed ($?) for ${URL}"
This only works if CSE_ADDRESS is a valid address, though.
You can test it first (more or less correctly already) via
s-nail -:/ -X'vput addrcodec x e '"${CSE_ADDRESS}" -X'xit $?' ||
echo >&2 "CSE_ADDRESS ($CSE_ADDRESS) is invalid" && exit 11
before you go sending a mail.
Happy Hacking!
I will have a nice Sunday instead ^_^
Ciao!
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)