Question

Stop the php5 cron emails

Hi, I have installed SSMTP - and everything works, but now I’m getting some Cron emails that I wasn’t expecting.

I’ve tried a number of things to try to disable them, but nothing seems to be working.

Delivered: root@windfarmstudios.com → postmaster@windfarmstudios.com 'Cron <root@windfarm> [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime) > /dev/null 2>&1'

I’ve tried adding mailto="" before the cron command. I’ve also tried appending > /dev/null 2>&1 as you can see above.

Anyone have some suggestions?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Chaining the commands this way should result in a single exit which would have it’s output redirected to /dev/null preventing the email but without seeing the exact line in the crontab it’s hard to tell for sure.

The mailto option to stop all cron related emails can be done like this.

Open /etc/crontab in an editor

You should see these lines:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

Directly after those, append:

MAILTO=""

Then save the file and run

service cron restart

and the change should take effect.