I'm running a PHP script in a cronjob and I want to send emails every 5 minutes
My current (crontab) cronjob:
10 * * * * /usr/bin/php /mydomain.in/cromail.php > /dev/null 2>&1
The cronmail.php is as follows:
<?php
$from = 'D'; // sender
$subject = 'S';
$message = 'M';
$message = wordwrap($message, 70);
mail("myemail@gmail.com", $subject, $message, "From: $fromn");
?>
But I've not received an email in 30 minutes with this configuration.
In a
crontab
file, the fields are:So:
means execute
blah
at 10 minutes past every hour.If you want every five minutes, use either:
meaning every minute but only every fifth one, or:
for older
cron
executables that don't understand the*/x
notation.If it still seems to be not working after that, change the command to something like:
and monitor that file to ensure something's being written every five minutes. If so, there's something wrong with your PHP scripts. If not, there's something wrong with your
cron
daemon.