Cronjob - How To Output Stdout, And Ignore Stderr
Is it possible to output stdout to file, but ignore stderr? I have a Python script that uses sys.stderr.write(error) to output errors to stderr. I'd like to ignore these for this p
Solution 1:
The 2>&1
redirects stderr
to stdout
, appending it to the headlines.txt
.
So, redirect stderr
to /dev/null
:
* * * * * /Users/me/bin/scrape-headlines /Users/me/proxies.txt >> /Users/me/headlines.txt2> /dev/null
Solution 2:
You can use the "2" descriptor to control stderr
separately and, e.g., redirect it to /dev/null
:
* * * * * /Users/me/bin/scrape-headlines /Users/me/proxies.txt >> /Users/me/headlines.txt2>/dev/null
Post a Comment for "Cronjob - How To Output Stdout, And Ignore Stderr"