Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running a php task every 24 hours

I have some functions that use curl to pull information off a couple of sites and insert them into my database. I was just wondering what is the best way to go about executing this task every 24 hours?

I am running off windows now, but will probably switch to linux once I am live (if that makes a difference). I am working inside symfomy framework now.

I hear cronjobs can do this this...but looking at the site it seems to work remotely and I would rather just keep things in house...Can i just "run a service" on my computer? whatever that means ;) (have heard it used)

thanks for any help, Andrew

like image 747
Andrew Avatar asked Feb 03 '09 16:02

Andrew


2 Answers

This is exactly what Cron (linux) or Scheduled Tasks (windows) are for.

You can run them on your application server to keep everything in one place.

For example, I have a cron running on my home server to backup its MySQL databases every day. Only one system is involved in this process.

like image 58
Michael Haren Avatar answered Nov 06 '22 05:11

Michael Haren


Adding 0 0 * * * php /path/to/your/cronjob.php to your crontab should accomplish this.

like image 38
barfoon Avatar answered Nov 06 '22 05:11

barfoon