View Single Post

   
  #1 (permalink)  
Old 02-20-2008, 07:02 PM
Mike Denhoff
 
Posts: n/a
Default sendmail replacement script

On Tue, 19 Sep 2006 18:37:17 +0000, Sylvain Robitaille wrote:

> Ok, then you likely only need to know that Sendmail doesn't need to
> be reachable from the network to do local delivery. In fact you
> probably should have a mail daemon running (at least locally) so you can
> receive any output from other cronjobs (for example if any of them
> fail).
>

I don't want to install sendmail, but I still want to see messages from
cron. I wrote the following script

#!/bin/bash
# MD 30 Jan 06
# to replace sendmail mv this to /usr/sbin/sendmail
cat >> /home/mike/fromSendmail.txt
echo $( date ) >> /home/mike/fromSendmail.txt
echo $@ >> /home/mike/fromSendmail.txt
exit 0

When cron sends an email it just gets appended to the file
/home/mike/fromSendmail.txt. I could instead have the script send an
email using nail with a line something like


cat | /usr/bin/nail -s "cron message $(date)" \
-r mike@address denhoff@mail.server


Mike
Reply With Quote