Package: cron-apt
Severity: wishlist
Hi,
please consider applying the attached patch which will allow run-time
customization of the subject of e-mails sent out. This might be
helpful in settings where a small number of unstable systems sends out
cron-apt messages to the same mailbox as a larger number of stable
systems to see immediately whether a cron-apt message originated on an
unstable system or not.
This patch also does kind of a clean-up for the handling of the
HOSTNAME variable.
It is idempotent if none of the new configuration variables is used.
Suggested documentation in /etc/cron-apt/config:
# Override default subject of E-Mails to be sent out in case of a
# successful cron-apt run. Default is
# "CRON-APT $SUBJECTSUPPL completed on $HOSTNAME [$CONFIG]"
# OKSUBJECT=""
# Override default subject of E-Mails to be sent out in case of
# a cron-apt run that ended in an error. Default is
# "CRON-APT $SUBJECTSUPPL error on $HOSTNAME [$CONFIG]"
# ERRSUBJECT=""
# Modify subject of E-Mails send out after a cron-apt run. The
# supplement string is inserted into the default string
# "CRON-APT $SUBJECTSUPPL (completed|error) on $HOSTNAME [$CONFIG]"
# SUBJECTSUPPL=""
Greetings
Marc
--- cron-apt 2015-12-15 23:01:13.549108700 +0100
+++ /usr/sbin/cron-apt 2015-12-17 14:26:50.568026395 +0100
@@ -246,10 +246,9 @@
MINTMPDIRSIZE=10
# The command to use (can be aptitude instead)
APTCOMMAND="/usr/bin/apt-get"
-# If HOSTNAME is non-empty, the contents will be used to generate the
-# e-mail subject for notifications sent out. If HOSTNAME is empty, the
-# output of $(uname -n) will be used.
-HOSTNAME=""
+# HOSTNAME will be used to generate the e-mail subject for notifications
+# sent out.
+HOSTNAME="$(uname -n)"
# Ignore lines matching this regexp to determine whether changes occurred
# for MAILON="changes".
DIFFIGNORE=""
--- functions 2015-12-15 23:01:33.221130707 +0100
+++ /usr/share/cron-apt/functions 2015-12-17 14:25:12.104333094 +0100
@@ -94,12 +94,9 @@
fi
if [ -f "$MAIL" ] && [ "$MAILON" != "never" ] && [ -n "$MAILON" ] ; then
if command -v mail >/dev/null; then
- if [ -z "$HOSTNAME" ]; then
- HOSTNAME="$(uname -n)"
- fi
- SUBJECT="CRON-APT completed on $HOSTNAME [$CONFIG]"
+ SUBJECT="${OKSUBJECT:-CRON-APT ${SUBJECTSUPPL:+$SUBJECTSUPPL }completed on $HOSTNAME [$CONFIG]}"
if [ -f "$ERROR" ] ; then
- SUBJECT="CRON-APT error on $HOSTNAME [$CONFIG]"
+ SUBJECT="${ERRSUBJECT:-CRON-APT ${SUBJECTSUPPL:+$SUBJECTSUPPL }error on $HOSTNAME [$CONFIG]}"
fi
# Support for XHEADERS
IFSOLD=$IFS