Subject: misc/3996: root crontab should include host name in subject for mailed maintenance-script output
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jbernard@tater.mines.edu>
List: netbsd-bugs
Date: 08/16/1997 08:12:31
>Number:         3996
>Category:       misc
>Synopsis:       root crontab should include host name in subject for mailed maintenance-script output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 16 07:20:00 1997
>Last-Modified:
>Originator:     Jim Bernard
>Organization:
	speaking for myself
>Release:        August 16, 1997
>Environment:
System: NetBSD zoo 1.2G NetBSD 1.2G (ZOO) #0: Sat Jul 19 12:48:58 MDT 1997 jim@zoo:/jaz/home/local/compile/sys/arch/i386/compile/ZOO i386


>Description:
	The daily, weekly, and monthly script output is mailed to root with
	a subject specified in root's crontab entries, but that subject does
	not include the host name, requiring the recipient to look at the
	mail (header or body) to figure out which host's report is there.
	If some hosts have higher monitoring priority than others, it's nice
	to know immediately when examining the table of contents presented
	by one's mailer which host's output is in which message.
>How-To-Repeat:
	Receive daily (etc.) output from several hosts and have to look at
	message (rather than just subject presented in table of contents
	generated by mailer) to find out which host it came from.
>Fix:
	Just add `/bin/hostname` to the subjects.

	Aside: The daily, weekly, and monthly scripts themselves generate
	a Subject: line that does contain the host name, but since the
	output is mailed with /usr/bin/mail instead of sendmail, that line
	appears in the body rather than the header of the message.  An
	alternative fix would be to mail the output with sendmail, but that
	generates a message with no "To:" header (not a serious defect).
	With the use of /usr/bin/mail to mail the output, there's no real
	point in having the "Subject:" prefix on the first line of output
	from daily/weekly/monthly, though it is nice to have the rest of
	the line present.  The latter changes are not included here.

--- crontab-dist	Sun Jan  5 05:13:15 1997
+++ crontab	Sat Aug 16 07:50:45 1997
@@ -14,6 +14,6 @@
 0	*	*	*	*	/usr/bin/newsyslog
 #
 # do daily/weekly/monthly maintenance
-0	2	*	*	*	/bin/sh /etc/daily 2>&1 | tee /var/log/daily.out | mail -s "daily output" root
-30	3	*	*	6	/bin/sh /etc/weekly 2>&1 | tee /var/log/weekly.out | mail -s "weekly output" root
-#30	5	1	*	*	/bin/sh /etc/monthly 2>&1 | tee /var/log/monthly.out | mail -s "monthly output" root
+0	2	*	*	*	/bin/sh /etc/daily 2>&1 | tee /var/log/daily.out | mail -s "`/bin/hostname` daily output" root
+30	3	*	*	6	/bin/sh /etc/weekly 2>&1 | tee /var/log/weekly.out | mail -s "`/bin/hostname` weekly output" root
+#30	5	1	*	*	/bin/sh /etc/monthly 2>&1 | tee /var/log/monthly.out | mail -s "`/bin/hostname` monthly output" root
>Audit-Trail:
>Unformatted: