cronjob confusion

cronjob confusion

Posted by: pjek
Posted on: 2007-10-05 06:47:00

I want to use the cronjob panel to run a php script on one of my subdomains. The script is named cron.php and I can run it manually from http://classifieds.purewaterandmore.com/cron.php

I simply do not understand how to fill in the cronjob at the panel to make it work. I have tried everything I found in the wiki and in the other users confusion.

Any help out there?

Re: cronjob confusion

Posted by: patricktan
Posted on: 2007-10-05 08:29:00

Have you read this http://wiki.dreamhost.com/Crontab Please pay attention on give full path of PHP
If you follow the article, it should be quite straight forward to setup a crontab.

For example, if you want to run your cron.php file hourly.

1. If you want to set it up from panel, in "type command to run" type command:
/usr/local/php5/bin/php /home/youruser/classifieds.purewaterandmore.com/cron.php
for php5 or
/usr/local/bin/php /home/youruser/classifieds.purewaterandmore.com/cron.php
for php4

* read the article for full information


2. if you want to create crontab in shell, type command:
crontab -e
0 * * * * /usr/local/php5/bin/php /home/youruser/classifieds.purewaterandmore.com/cron.php
for php5 or
0 * * * * /usr/local/bin/php /home/youruser/classifieds.purewaterandmore.com/cron.php
for php4

* read article for full information

The difference is that you do not need to key in 0 * * * * * at the panel. You select the option from the drop down menu

Re: cronjob confusion

Posted by: sdayman
Posted on: 2007-10-05 16:10:00

If you can run it manually, then put this in the cron field in the Panel:
/usr/bin/curl classifieds.purewaterandmore.com/cron.php

And tell it how often you want it to run.

-Scott

Re: cronjob confusion

Posted by: pjek
Posted on: 2007-10-05 18:01:00

@patricktan

I had tried this already and it didn't work.

But since one of course can never be sure not to have forgotten something I copied the command as you proposed, replaced <b>youruser with my username (the one authorised for shell access.

I regret to tell you that it did not work, the cronjob did not happen :(

Re: cronjob confusion

Posted by: pjek
Posted on: 2007-10-05 18:08:00

@sdayman

Have to admit also to you that I read your solution in another post yesterday and tried that also already, nevertheless, since I could have made a mistake, I tried it again just now.

No result :(

Re: cronjob confusion

Posted by: sdayman
Posted on: 2007-10-05 19:03:00

Bizarre. If you can run it "manually," then curl should be just effective. What makes you think that running it manually worked, and that running it via curl didn't work?

-Scott

Re: cronjob confusion

Posted by: pjek
Posted on: 2007-10-06 14:23:00

When I do http://classifieds.purewaterandmore.com/cron.php in my browser and then check the log file in my website, I find that the cronjob has been executed. When I wait for the curl to make it happen, it just doesn't happen, I did it manually 19 hours ago and that is still the status in my log files.

I just checked it manually again and now it is updated to 7 seconds ago.

Re: cronjob confusion

Posted by: rlparker
Posted on: 2007-10-06 14:51:00

Did you try the approach detailed in the DH Wiki article on running PHP from cron?

You might give that a try. wink

--rlparker

Re: cronjob confusion

Posted by: pjek
Posted on: 2007-10-06 14:55:00

Ohkee, I think I found it out. Using the cURL feature it actually worked, I had to use the following syntax though

/usr/bin/curl http://classifieds.purewaterandmore.com/cron.php

Pls notice the http:// before the classifieds.

It works, thanks for helping me out here

Re: cronjob confusion

Posted by: rlparker
Posted on: 2007-10-06 14:59:00

In reply to:

Pls notice the http:// before the classifieds.


Yep! That makes sense. Woo Hoo! I'm glad you got it working! smile

--rlparker

Tags: cronjobcronconfusionphotoblogi can runphp scriptsubdomainsmanuallywiki