Hey fella's,
I added a php script to cron and every time it finishes, it ouputs the ENTIRE results in my EMAIL, and well, it's BIG freaking files, I'm thinking that it hurts my server to email these, and I don't want it to email me.....
so what should I do to make it so the output is discarded?
0 * * * * /usr/bin/php /path/to/script/script.php > /dev/null
is the "> /dev/null" something I should add and what eXACTLY will that do?
Thank you. Main thing Is I want my server to stop emailing the entire output of the script
Cron Daemon emails when php script finsihes?
Moderator: General Moderators
And what happens with stderrr?
I redirect it to stdout.. which goes to /dev/null
Here's an example of my crontab:
0 0 * * * /home/users/timvw/bin/chmoder.sh > /dev/null 2>&1
# * * * * * *
# | | | | | |
# | | | | | +--------- command to be executed
# | | | | +---------------- day of week (1 - 7) (monday = 1)
# | | | +------------------- month (1 - 12)
# | | +---------------------- day of month (1 - 31)
# | +------------------------- hour (0 - 23)
# +--------------------------------------- min (0 - 59)
ok great, so > /dev/nulltimvw wrote:And what happens with stderrr?I redirect it to stdout.. which goes to /dev/null
Here's an example of my crontab:
0 0 * * * /home/users/timvw/bin/chmoder.sh > /dev/null 2>&1
# * * * * * *
# | | | | | |
# | | | | | +--------- command to be executed
# | | | | +---------------- day of week (1 - 7) (monday = 1)
# | | | +------------------- month (1 - 12)
# | | +---------------------- day of month (1 - 31)
# | +------------------------- hour (0 - 23)
# +--------------------------------------- min (0 - 59)
is the RIGHT thing to do, and my script will run 100% no problem, and things like curl, file_get_contents, fopen, fwrite, fputs, all these will still work right? It's just the echo "" stuff that will go to /dev/null correct?
Also,
differernce between
/dev/null
and
/dev/null 2>&1
please?
~Des
well, if you do > /dev/null everything that is on the standard output device will go to /dev/null (instead of displaying on your shell or being e-mailed to you if there is no shell)
If php reports errors are warnings this will go to the standard error device, and you'd still recieve e-mails
so you send everyting from the stderr to stdout (2 > &1).. And since stdout goes to /dev/null it's all quiet...
Now you have to be sure nothing can/will go wrong (since you won't be notified..)
If php reports errors are warnings this will go to the standard error device, and you'd still recieve e-mails
so you send everyting from the stderr to stdout (2 > &1).. And since stdout goes to /dev/null it's all quiet...
Now you have to be sure nothing can/will go wrong (since you won't be notified..)