Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a PHP script continuously on webhost?

I have a PHP script that retrieves list of urls from a site and stores them in a MYSQL table. I want to run the script again and again [with some time delay] and update the table. I am using codeigniter framework.

How can I do it?

  • Should I run a cron job?
  • Or should I make a start/stop page with infinte loop?

P.S my webhost is GoDaddy

like image 414
Jagira Avatar asked Mar 05 '10 10:03

Jagira


2 Answers

The first option would be a better go:

Should I run a cron job?

Avoid using infinite loops.

like image 146
Sarfraz Avatar answered Oct 24 '22 18:10

Sarfraz


If your webhost doesn't support cron, there are PLENTY of online services that will call your remote page every 1, 5, 60 minutes etc.

http://www.setcronjob.com/

Is one I've used before. Type in "online cron job" in google and you have your pick of about 20.

edit: The free version of what I linked above is limited to one call per 5 minutes. There may be other free ones that are better.

like image 40
Erik Avatar answered Oct 24 '22 16:10

Erik