Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
I want to write a set of scripts, this is what I want to do and my question(s):
-Depending on a set of paramaters a script I have written needs to be run every X hours (this can range from 1 hour to 12 hours)
-When X hours is up, how can I get that script to automatically run? Is it a cron job triggered via PHP or does PHP have some kind of clock/timer functionality built in?
Toughy is this, but I'm sure one of you will have a good idea (at least one of you ).
You don't specify the script language (assume PHP) or operating system.
On linux you you simply have the cron job to run "php -f scriptname.php" or whatever...
if you dont want these scripts running all the time, you might want to look into at jobs to set the scripts to run when you want, and call that from the php script using an exec command.
Thank you both for your responses. I am using PHP, the testing server is OSX, the live server is Linux.
I will have a look at the AT jobs suggestion from Wayne and see what that's all about.
Basically I want a timer that runs a script when the timer counts down to 0. The time will be different each time based on other variables. Due to this the cron job might not work as I believe they are usually run at an exact time each time they are run?
I awoke this morning, pencil n paper, working out all these ideas and when I login to DevNetwork Forums... you have that great reply for me. I'd like to say thanks.
Thinking out loud now, I imagine it would be something like this:
-Timer is set to X hours
-Every 10 mins (for example) checker script runs via a Cron job, does a quick check on the timer script to see if timer is at 0 yet.
-If timer is at 0, do actions and reset timer to Y depending on other variables
-If timer is not at 0, do nothing
What I love about programmers (I'm an artist ) is they keep it simple, and what a brilliant simple solution that is. Thanks again...