Jump to content

How do I execute a script once every hour?


pasychosheep

Recommended Posts

Hey guys, first post(yaaaay!), and I've got an interesting problem that I'm not sure how to even go about doing.

 

I need a PHP script to execute every hour, on the hour, 24 hours a day, without anyone externally loading a page or anything.  I have a feeling I can't do this with just straight PHP, but I really don't know how to go about getting it to work.  Can anyone help?

cron ....

 

 

you need a cron job, it a program that let other programs execute via time set.

 

http://cronw.sourceforge.net/ << windows version.

 

most common version is free on lynx also used on most holsters.

 

also for windows you can use the scheduler.

 

http://support.microsoft.com/kb/308569 scheduler info.

professorial way.

 

http://www.d9x.net/linux/guides/crons.php

 

 

 

 

http://www.webmasterworld.com/forum23/80.htm

 

The format of the entry looks like this:

 

minute hour day-of-month month-of-year day-of-week command

 

minute 00 through 59

hour 00 through 23 (midnight is 00)

day-of-month 01 through 31

month-of-year 01 through 12

day-of-week 01 through 07 (Monday is 01, Sunday is 07)

 

All five fields must be specified, but an asterisk can be used to match any time/date field. So to build an entry that would run "command" every fifteen minutes you would create a file with a text editor and place an entry in it like this:

 

15,30,45,59 * * * * command

 

Which would run "command" at 15 min, 30 min, 45 min, and 59 min, of every hour, of every day, of every month, of every week.

 

Let's say you named that file "schedule", you would then issue the command -

 

crontab schedule

 

It will then install your crontab file with the contents of "schedule" and create a new file named after your userid.

 

You should not edit that file directly, instead add, delete, or modify the text file you created and issue the crontab command again, and it will replace the crontab file with the new contents.

 

All going well, "command" should then run as scheduled.

 

It's been a while since I did anything with cron, hope I haven't forgotten anything ....

 

visual look easy way full tutorial

 

http://www.siteground.com/tutorials/cpanel/cron_jobs.htm

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.