Thread: more cron jobs
View Single Post
Old 06-01-2002, 02:00 PM   #4 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
You might try something like this, it'll redirect the output of your errors to /dev/null or to a logfile of your choosing. Remember that anything in the crontab must use absolute paths, so you can't just stick ~/cron.log into a crontab entry.

Code:
## example crontab to redirect error output

# will send to the bit bucket
0-59/1 * * * *    exec /path/to/command 2&1> /dev/null

# will send to a log file
0-59 * * * *    exec /path/to/othercommand 2&1> /home/username/logs/command.log
Hope this helps!

BTW, the 2 is the shell's standard error output channel, while 1 is the shell's standard output channel. You can use one or both to redirect output from commands.
bdl is offline   Reply With Quote