I know that default cron's behavior is to send normal and error output to cron's owner local email box.
Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on) ?
I know that default cron's behavior is to send normal and error output to cron's owner local email box.
Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on) ?
The cron line is just like any other unix command line so you can redirect output to another program. Ie.
* * * * * /path/my/command > /my/email/script 2&>1
You could chuck file redirection onto either the command shown or the actual command in the crontab for both stdout and stderr - like command > /tmp/log.txt 2>&1
.
If you want several users to receive this log, you could insert a MAILTO=nameofmailinglist
at the top of you cron file.
This may be an unnecessary addition, but to qualify the redirection commands:
> redirects standard output
2 is a Bourne shell specific term that means standard error
1 is a Bourne shell specific term that means standard output
2>&1 means redirect the standard error to standard output
Also see the following useful article Standard Input and Output Redirection
To email the output to a different email address just add the line
MAILTO="[email protected]"
To the crontab before the command
As far as I see it you've got three options:
Redirect the output: either to a file, or to a program that will email the results as you want them
Use MAILTO in cron, and redirect the email to any other single address for all your cron jobs.
Do the redirection in your mail server or client, after cron has sent it.