Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: Thomas Anders <anders@hmi.de>
Subject: Re: cron: mail with subject?
Date: 18 Apr 2002 11:09:53 +0200	[thread overview]
Message-ID: <0relhdxti6.fsf@display.hmi.de> (raw)
In-Reply-To: a8vfsa$658@web.eng.baileynm.com

peter@abbnm.com (Peter da Silva) writes:
> Thomas Anders  <anders@hmi.de> 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 <anders@hmi.de>
Hahn-Meitner-Institut Berlin, Germany


      reply	other threads:[~2002-04-18  9:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-02 15:35 cron: mail with subject? Thomas Anders
2002-04-04 11:37 ` Thomas Voegeli
2002-04-08  9:19   ` Thomas Anders
2002-04-09 19:36 ` Peter da Silva
2002-04-18  9:09   ` Thomas Anders [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox