[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cron jobs + (some?) output



Hugo Vanwoerkom wrote:
...
I run mplayer from a script in the early morning as a cron job.
My problem (small one) was that since there is no shell, where is the output? Gues what: it gets sent to root!

Yes, output from cron processes is sent via e-mail to the owner of the process using local mail delivery agent. This is the standard way it works. SURPRISE! (he he, just kidding, but this has been hapenning for at least 15 years.)

If you were running the process in the root crontab, then the output of the commands will be sent to the root user via local "mail" command.

If you want to stop this, you can redirect the output of the mplayer to a file every day.... for example, in your crontab have something like this: (Remember to remove the newlines, this is wrapped at 80 chars)

3 4 * * * rm -f /var/log/mplayer.log; mv /var/log/mplayer.log /var/log/mplayer.log.yesterday; mplayer -command -options blah blah > /var/log/mplayer.log 2>&1

This command will create a new log every day, and keep yesterdays log too, but will lose all older logs.

-Ben.



Reply to: