Linux – how to make a php crontab silent

cronlinuxPHP

I set up a crontab in Cpanel to run every min. It's working great but I don't want an e-mail every min. I have a second cron tab that runs every day. I would like the responce of this tab. Is there a way to tell the crontab to be silent or only e-mail on error?

I have:

    *    *  *   *   * php /home/public_html/folder/file.php 2>&1

The last bit 2>&1 I added because i thought it would make it silent.

From the Cpanel Docs:

You can have cron send an email everytime it runs a command. If you do not want an email to be sent for an individual cron job you can redirect the command's output to /dev/null like this: mycommand >/dev/null 2>&1

Best Answer

use -q it means "quiet" and thus doesn't generate output

*    *  *   *   * php -q /home/public_html/folder/file.php

also, ask yourself why you want to run it every minute, that's a little excessive.

Related Topic