[nzlug] cron
Jim Cheetham
jim at gonzul.net
Mon Jun 9 09:53:48 NZST 2008
On Mon, Jun 9, 2008 at 9:27 AM, Nevyn <nevynh at gmail.com> wrote:
> Right you are. Does anyone know how to enable cron to output a log file?
cron syslogs the fact that it is active, but that doesn't include
details of the command that it ran for you.
Any output from your command is emailed to the initiating user. If you
don't want this, redirect the command output yourself ...
*5 * * * * /home/fred/bin/command >> /home/fred/log/command.log 2>&1
That way both STDOUT and STDERR will find their way into your log
file, cron won't see any output, and won't email anything.
If your command is a bash shell script, consider turning on "set -x"
which shows you the expanded version of each command before it is
executed ...
-jim
More information about the NZLUG
mailing list