error to null in cron jobs

Jason Joines joines
Mon May 17 11:53:48 PDT 2004


Tim Wunder wrote:
> On 9/16/2003 12:23 PM, someone claiming to be Jason Joines wrote:
> 
>> Michael Hipp wrote:
>>
>>> Jason Joines wrote:
>>>
>>>>   When I do the same thing in a script via cron, I get the error in 
>>>> the ouput even with 2>/dev/null.
>>>
>>>
>>>
>>>
>>> I generally use &> /dev/null to keep things quiet.
>>>
>>> You can also put that at the end of the line in /etc/crontab to quiet 
>>> the whole cron job.
>>>
>>> Michael
>>>
>>
>>   I tried the &>/dev/null but that gets rid of the non-error output as 
>> well.  I want that ouput.
>>
> 
> The 2>/dev/null directive in the cron job sends the error output of the 
> cron job to /dev/null, you want the error output of the script to go to 
> /dev/null. Not sure how exaclty to do that, but perhaps by entering 
> '<scriptname> 2>dev/null' as the command to execute in the cron job? 
> Either that, or write a wrapper script to call your script with the 
> command parameters.
> 
> HTH,
> Tim


   I tried using the "'<scriptname> 2>dev/null' as the command to 
execute in the cron job?" solution.

   It worked great.

Thanks,

Jason
===========



More information about the Linux-users mailing list