Public bug reported: Binary package hint: apcupsd
Acupsd is a really nice package, so this is just a suggestion for a small improvement. By default, acupsd emails me (i.e. system admin) on power outage, and when power returns. However, these emails have different subjects, and thus tend to get threaded separately, while ideally, events belonging together should thread together. The easiest solution is through the scripts (/etc/acupsd/offbattery and onbattery) to record the message ID and set an appropriate References or In-Reply-To header in the emails. Here's my attempt, but this can probably be done more elegantly: ==> /etc/apcupsd/offbattery <== #!/bin/sh # # This shell script if placed in /etc/apcupsd # will be called by /etc/apcupsd/apccontrol when the # UPS goes back on to the mains after a power failure. # We send an email message to root to notify him. # SYSADMIN=root APCUPSD_MAIL="mail" HOSTNAME=`hostname` MSG="$HOSTNAME Power has returned" if test -f /var/lib/apcupsd/$HOSTNAME.power; then LASTEVENT=`cat /var/lib/apcupsd/$HOSTNAME.power` fi # ( echo "Subject: $MSG" echo " " echo "$MSG" echo " " /sbin/apcaccess status ) | $APCUPSD_MAIL -a "In-Reply-To: $LASTEVENT" -s "$MSG" $SYSADMIN exit 0 ==> /etc/apcupsd/onbattery <== #!/bin/sh # # This shell script if placed in /etc/apcupsd # will be called by /etc/apcupsd/apccontrol when the UPS # goes on batteries. # We send an email message to root to notify him. # SYSADMIN=root APCUPSD_MAIL="mail" HOSTNAME=`hostname` MSG="$HOSTNAME Power Failure !!!" MSGID="<"`date +%H%M%S`"@$HOSTNAME>" echo $MSGID > /var/lib/apcupsd/$HOSTNAME.power # ( echo "Subject: $MSG" echo " " echo "$MSG" echo " " /sbin/apcaccess status ) | $APCUPSD_MAIL -a "Message-Id: $MSGID" -s "$MSG" $SYSADMIN ** Affects: apcupsd (Ubuntu) Importance: Undecided Status: New ** Description changed: Binary package hint: apcupsd Acupsd is a really nice package, so this is just a suggestion for a small improvement. By default, acupsd emails me (i.e. system admin) on power outage, and when power returns. However, these emails have different subjects, and thus tend to get threaded separately, while ideally, events belonging together should thread together. The easiest solution is through the scripts (/etc/acupsd/offbattery and onbattery) to record the message ID and set an appropriate References or In-Reply-To header in the emails. Here's my attempt, but this can probably be done more elegantly: + ==> /etc/apcupsd/offbattery <== #!/bin/sh # # This shell script if placed in /etc/apcupsd # will be called by /etc/apcupsd/apccontrol when the # UPS goes back on to the mains after a power failure. # We send an email message to root to notify him. # SYSADMIN=root APCUPSD_MAIL="mail" HOSTNAME=`hostname` MSG="$HOSTNAME Power has returned" if test -f /var/lib/apcupsd/$HOSTNAME.power; then LASTEVENT=`cat /var/lib/apcupsd/$HOSTNAME.power` fi # ( echo "Subject: $MSG" echo " " echo "$MSG" echo " " /sbin/apcaccess status ) | $APCUPSD_MAIL -a "In-Reply-To: $LASTEVENT" -s "$MSG" $SYSADMIN exit 0 ==> /etc/apcupsd/onbattery <== #!/bin/sh # # This shell script if placed in /etc/apcupsd # will be called by /etc/apcupsd/apccontrol when the UPS # goes on batteries. # We send an email message to root to notify him. # SYSADMIN=root APCUPSD_MAIL="mail" HOSTNAME=`hostname` MSG="$HOSTNAME Power Failure !!!" MSGID="<"`date +%H%M%S`"@$HOSTNAME>" echo $MSGID > /var/lib/apcupsd/$HOSTNAME.power # ( echo "Subject: $MSG" echo " " echo "$MSG" echo " " /sbin/apcaccess status ) | $APCUPSD_MAIL -a "Message-Id: $MSGID" -s "$MSG" $SYSADMIN -- acupsd email should be properly threaded https://bugs.launchpad.net/bugs/392106 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs