I want to create some function to schedule php scripts,for example if i want tu run page.php at 12/12/2012 12:12 i can call
schedule_script(\'12/12/2012 12:1
There's a PHP function which lets you delay script execution till a point in time.
So let's say I have cron.php:
And your classes/functions file:
// Const form K2F - Are we on windows?
define('ISWIN', strpos(strtolower(php_uname()),'win')!==false &&
strpos(strtolower(php_uname()),'darwin')===false );
// Function from K2F - runs a shell command without waiting (works on all OSes)
function run($cmd){
ISWIN ? pclose(popen('start /B '.$cmd,'r')) : exec($cmd.' > /dev/null &');
}
script_schedule($script,$time){
if(is_string($time))$time=strtotime($time);
run('php -f -- schedule '.escapeshellarg($script).' '.$time);
}
script_interval($script,$mseconds){
run('php -f -- interval '.escapeshellarg($script).' '.$mseconds);
}
It ought to work. By the way, K2F is this framework that makes your dreams come true..faster. ;). Cheers.
Edit: If you still want the parts about counting running jobs and/or deleting(stopping) them, I can help you out with it as well. Just reply to my post and we'll follow up.