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

Re: [K12OSN] some scripting help



Ray Garza wrote:
On Saturday 12 May 2007 09:50:49 Nils Breunese wrote:
Ray Garza wrote:
On Saturday 12 May 2007 08:50:33 Nils Breunese wrote:
    ls /home/$account/.mozilla/firefox/*.default/cache 2>/dev/null
I just saw this on a link that I've been reading up on at
http://www.faqs.org/docs/abs/HTML/zeros.html

I plan to run it as a cron job
but I don't want the error messages popping up on the screen. Is there
a way to suppress the error message? Will putting it in a cron job log
the error but not display it?
I believe by default any output generated by cron jobs is mailed to the
user the script runs as. You can override the address by setting MAILTO=
in the crontab. You can also redirect all output of the cron job to
/dev/null:

    /path/to/script >/dev/null 2>&1
Ok, it's a little different here
What do you mean exactly?

in the script it 2>/dev/null

and redirect output of the scron job it's
2>&1

That's what I meant that it's a little different

Cron jobs never send messages to the screen because they aren't connected to any screen. They collect anything sent to stdout (file descriptor 1) and stderr (2) and mail it to the owner of the job. If you don't want the mail, you can redirect this output elsewhere.
2>/dev/null discards stderr by sending to the null device.
2>&1 sends stderr to the same place as stdout (which may have been redirected elsewhere already.

--
  Les Mikesell
    les futuresource com


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