LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Is the 2>&1 necessary? (https://www.linuxquestions.org/questions/linux-newbie-8/is-the-2-and-1-necessary-230432/)

dominant 09-14-2004 06:52 AM

Is the 2>&1 necessary?
 
In my cron table i put a line like that
0 2 * * * /usr/local/bin/myscript.pl > /var/log/mylog.log

I forgot to put the 2>&1 at the end of the line above and it worked as i expected, no email came to my inbox, but in the /var/log/mylog.log

Now, i am wondering about the necessity of 2>&1

rjlee 09-14-2004 07:00 AM

2>&1 Redirects any error messages (or anything sent to standard error) to standard output. Without it, error messages will be logged to the cron process, which I think puts them in syslog (ending up in /var/log/messages) rather than emailing them to you (which is what happens with standard output).


All times are GMT -5. The time now is 11:21 AM.