Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

Scheduling a script run at specifictime or interval
Welcome, Guest. Please login or register.
December 02, 2008, 07:32:13 AM
11304 Posts in 1248 Topics by 498 Members
Latest Member: katCheeme
Experts Round Table Network  |  Serverside Technology  |  PHP  |  Scheduling a script run at specifictime or interval « previous next »
Pages: [1]
Author Topic: Scheduling a script run at specifictime or interval  (Read 315 times)
thepreacher

Offline Offline

Posts: 77


« on: June 27, 2007, 09:34:19 AM »

Hi guys, i am about to write a script (like an end of day program and also one that should run every 30 mins ) that should execute periodically and do some stuff. I have never done anything like that before.

How do I get a script to do that please.

Regards all
Logged
Esopo
Governing Council Member
*
Offline Offline

Posts: 74


WWW
« Reply #1 on: June 27, 2007, 01:10:40 PM »

Hi,

I normally use cron for that purpose:

http://www.google.com/search?q=cron+jobs

Best regards,

Esopo.
Logged
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #2 on: June 28, 2007, 06:26:44 AM »

two main solutions :
1) leave a browser window open somewhere with a refresh period
2) perform off-line calls. If you coded your PHP scripts to ba calleable with the CLI mode (see PHP.net for the CLI mode), then cron, AT, the W$ scheduler or a lot of other tools can just call the script.
2b) if you didn't adapt the script to CLI - so it works nominally only when called from a browser window in GET/POST HTTP mode - and you "accidentally" run on W$, then you're stuck. That's why I build many years ago the free tool called RobotOuaibe that you'll be able to find on www.edainworks.com, topic "tools" or "third-party" - should be easy.

I use it to launch periodic daily tasks at different times of the day (like cleaning the logs, analysing them, producing stats, calling netcraft, calling other sites for parsing their contents, etc).

For running weekly, monthly, quarterly, yearly tasks, I code the necessary tests (when was the last run? what is the date now ? should I run? etc using a DB of the filesystem) in the necessary places and the updates run automatically - and once ! ;-) - whenever the script is called, and whatever the calling mode (user, myself, or RobotOuaibe)

As those tasks are just an aggregation of statistics, it's not necessary for them to run exactly when the last period is over, as long as they run the next time the script is called.
For daily tasks that need to be called every day, I use RobotOuaibe
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
Pages: [1]
« previous next »
    Jump to: