Page 1 of 1

cron jobs

Posted: Mon Oct 28, 2013 1:46 am
by tiger0
Hello guys. I am new here :D

I have some problems with the cron jobs. I used these two lines in my (cron.txt) file:

Code: Select all

MAILTO=myemail@gmail.com
1 0 * * * * php -f /home/my_user_name/public_html/cron.php
(note: I got this syntax from the web host)
"php -f /home/user_name/public_html/cron.php"


and in my (cron.php) file:

Code: Select all

<?php
$to= "myemail@gmail.com";
$subject = "Cron Job Status";
$from = "myemail@gmail.com";
$message = "The cron job is working fine."; 
mail($to,$subject,$from, $message); 
?>
and that cron.php file is working fine when I run in via the URL.

but it's not working although the permissions for both files are rwxr-xr-x

I also used the cron jobs function from the web host service, but still did not work..

any suggestion?

Re: cron jobs

Posted: Mon Oct 28, 2013 6:45 am
by Celauran
You have one too many asterisks in your crontab. It's minute, hour, day, month, day of week.

Re: cron jobs

Posted: Mon Oct 28, 2013 3:20 pm
by tiger0
Good point Celauran

Thanks.

I removed the extra asterisk, but still the command does not work

Re: cron jobs

Posted: Tue Oct 29, 2013 7:08 am
by Celauran
php-cli is installed? It works when you run it manually from the command line?

Re: cron jobs

Posted: Tue Oct 29, 2013 4:39 pm
by tiger0
I did not check it from the command line, but the both files cron.txt and cron.php are on the host server.

Re: cron jobs

Posted: Wed Oct 30, 2013 7:04 am
by Celauran
cron.txt? Is there some script that's parsing that? It may be as simple as adding this entry to your crontab (crontab -e from the shell)

Re: cron jobs

Posted: Wed Nov 20, 2013 4:29 am
by tiger0
Sorry for the late response Celauran

I could not do it through the shell on the website. I got some free website to do the cronjobs for me,

Thanks for your inof. I really appreciate it.