I have a php script in a cron job:
0 * * * * php -q /path/to/script.php
I use the -q
switch to suppress any output other than what the script itself produces. The script will only output content when there is something to see.
cron will send an email if there is output to stdout, which is exactly what I want.
However, it appears that php -q
will always output a carriage return. This is enough output to trigger crons email notification.
# php -q script.php > test.txt
# ls -la test.txt
-rw-r--r-- 1 test test 1 Oct 12 22:41 test.txt
Is there a way to get -q
mean "really output nothing"?