[nzlug] cron
Johann Schoonees
j.schoonees at irl.cri.nz
Mon Jun 9 10:41:03 NZST 2008
Jim Cheetham wrote:
> 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 ...
And watch our for commands that are not in cron's default PATH. On my
ubuntu hardy (from memory, it's at home) /bin is but not /usr/bin.
Johann
More information about the NZLUG
mailing list