Today after installing ssmtp in order to send e-mails using the terminal, I got every half hour this e-mails:
from: root <myuser>@gmail.com
to: root
date: Wed, Sep 12, 2012 at 2:09 PM
subject: Cron <root@127> [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete
mailed-by: gmail.com
content: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/memcached.so' - /usr/lib/php5/20090626/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
These are being sent from my own computer, as if a cron job is set up.
But I cannot find any cron job being planned.
I checked crontab with crontab -e
in my root account and in the normal account, but both are empty (except for the default comments explaining cron usage).
Is there any other way to check where this cron job is being executed?
on my linux box the following directories all can contain cron scripts that would be run:
/etc/cron.d/
/etc/cron.daily/
/etc/cron.hourly/
/etc/cron.monthly/
/etc/cron.weekly/
and more specifically I found your same cron php script also in my linux box as I have php installed, find it here:
cat /etc/cron.d/php5
# /etc/cron.d/php5: crontab fragment for php5
# This purges session files older than X, where X is defined in seconds
# as the largest value of session.gc_maxlifetime from all your php.ini
# files, or 24 minutes if not defined. See /usr/lib/php5/maxlifetime
# Look for and purge old sessions every 30 minutes
09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm
The php script is not sending the email, the cron daemon which runs that php script does sends it. It does so because the script outputs some error and cron sends an email to root to inform of that. Because of installing ssmtp mails sent to root get to you.
To make cron not send emails about that php script, add >/dev/null 2>&1
at the end of the php script line.
Then restart cron with /etc/init.d/crond restart
That should prevent cron from spamming you again :-) .