Jump to content
  • 0

Stop cron email going to admin@ email address


Web Hosting UK

Question

4 answers to this question

Recommended Posts

  • 0
19 minutes ago, Licensecart said:

You need to remove the email address if you can from the cronjob top bit or add >/dev/null 2>&1 to the end of the cronjob task

Eg:


/usr/local/bin/php /home/username/public_html/index.php cron >/dev/null 2>&1

 

Thanks, only had it for a week and had over 2500 e-mails :D

Link to comment
Share on other sites

  • 0

Just to quickly add to this one, > /dev/null 2>&1 pipes everything to the abyss, which means you'll even lose errors.

you may wish to remove the 2>&1 so you still get emails if there is an error, it may be helpful in the event errors occur, instead of silently failing :).

FYI:

>/dev/null = Pipe standard out to /dev/null
2>&1 = Pipe standard error to standard out, which in turn pipes to /dev/null

so removing 2>&1 means stderr (standard error) will still come through, so you'll get emails in the event of errors, otherwise not.

there are other ways to monitor your systems to ensure errors are picked up quickly, but they vary widely in complexity depending on requirements, so this is a rather simple approach, but can still be effective.

YMMV, but monitoring, logging, trend analysis, etc will help considerably with bug and outage detection, allowing you to maintain higher uptime and business continuity.
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...