Email inside cron
Daniel Widyono
widyono at cis.upenn.edu
Fri Aug 20 14:55:39 UTC 2004
> > /bin/mail -s "${MsgHeader} finished." ${MailTo} <${logfile}
> >
> > This works fine when I run the script interactively,
> > but no email is sent when I run ut as a cron job.
In your cron script, put "env" command before the mail command. Send output
to some file. In your interactive shell, compare output of "env" to cron's
output. Set environment to that of cron's environment, try to mail
interactively and see if it fails. If so, add whatever variables are
necessary to make it work, in the cron script.
Another issue with cron is that the standard i/o is different (no tty).
Not yet sure if that's an issue for your situation, or how to go about
working around it, if so.
Regards,
Dan W.
--
-- Daniel Widyono http://www.cis.upenn.edu/~widyono
-- Liniac Project, CIS Dept., SEAS, University of Pennsylvania
-- Mail: CIS Dept, 302 Levine 3330 Walnut St Philadelphia, PA 19104
More information about the redhat-list
mailing list