From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,da373674f918a272 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2002-04-18 03:00:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news-ber1.dfn.de!zrz.TU-Berlin.DE!news!not-for-mail From: Thomas Anders Newsgroups: comp.unix.tru64 Subject: Re: cron: mail with subject? Date: 18 Apr 2002 11:09:53 +0200 Organization: Hahn-Meitner-Institut Berlin Sender: dta@display.hmi.de Message-ID: <0relhdxti6.fsf@display.hmi.de> References: <0rn0wmxgdk.fsf@display.hmi.de> NNTP-Posting-Host: display.hmi.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dsnews.hmi.de 1019120993 24593 134.30.15.29 (18 Apr 2002 09:09:53 GMT) X-Complaints-To: usenet@dsnews.hmi.de NNTP-Posting-Date: Thu, 18 Apr 2002 09:09:53 +0000 (UTC) User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) Xref: archiver1.google.com comp.unix.tru64:7311 peter@abbnm.com (Peter da Silva) writes: > Thomas Anders wrote: > > Unfortunately the output of a cron job gets mailed with an empty > > subject line by default. Is there a way to globally change this > > behaviour in Tru64 Unix 5.1A without doing a "mailx -s" (or similar) > > in every single cron job? > > Two solutions: > > 1. Cron sends mail by calling /usr/bin/mail explicitly. Rename that to > /usr/bin/mail.real and create a new "/usr/bin/mail" that looks for > the line "Cron: The previous message is the standard output" and > does whatever it is you want instead. > > 2. Replace cron with one of the Open Source versions, such as this > one: http://freshmeat.net/projects/dcron/?topic_id=141 and you > can change its behaviour any way you want. What I ended up doing was similar to 1., but the other way around to not (potentially) break other programs using /usr/bin/mail: 1. edit /usr/sbin/cron to change the string "/usr/bin/mail" to "/foo/bin/mail" (two times; use Emacs hexl-mode or replace) 2. create a shell script /foo/bin/mail like this: #/bin/sh (echo "Subject: `hostname` cron output"; cat -) | /usr/bin/mail ${1+"$@"} Well, I was trying to avoid these sort of things ;) Kind regards, Thomas -- Thomas Anders Hahn-Meitner-Institut Berlin, Germany