[H-GEN] Cron Jobs and Logs
Michael Anthon
michael at anthon.net
Tue Feb 17 06:23:24 EST 2004
Greg Black wrote:
>
>
>It can be done, but mail(1) is actually designed as a mail
>reader, so it's a stretch to do what you want.
>
>
Well, it's not a "reader" as such, it's a very hard to use MUA... the
man page says
>DESCRIPTION
> mail is an intelligent mail processing system which has a command
syntax
> reminiscent of ed(1) with lines replaced by messages.
I have used it in various places where I've wanted to send output
quickly and simply. The easiest way is to pipe data into it or redirect
a file for it's stdin and set a subject and address on the command line
like so...
some_script | mail me at home.com -s "Output from script"
mail me at home.com -S "Some random file" < random_file
Works a treat and no need to manually generate headers (not that I'm
claiming this way produces terribly good headers but it's suitable for
most purposes where you might want to do this).
That said, the cron process, as Greg mentioned, should be sending you
anything from stdout or stderr of the processes that it runs. The email
will be sent to the owner of the cron job in question unless you
override that with the MAILTO option in the crontab file (man 5
crontab). If you aren't seeing emails from cron when you expect to see
them then you may not have the email system set up correctly... you do
have a mail alias set up for the root user on your system don't you?
Cheers,
Michael
More information about the General
mailing list