Advertisement
Advertisement
| 08.16.2008 at 04:11PM PDT, ID: 23654069 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: |
setCronJob(date('i', strtotime('+5 minute')), "*", "*", "*", "*", "CLUpdater", "sourcepages/SomeFile.php");
function setCronJob($min, $hour, $monthDay, $monthNum, $weekDay, $cronName, $page){
$command = "$min $hour $monthDay $monthNum $weekDay php -f /homepages/42/d160091301/htdocs/WebSites/MySite.com/www/$page";
$cron_file = "/homepages/ID/User/htdocs/WebSites/MySite.com/cronJobs/cron_$cronName.job";
// check for Feed_cron file. If it doesn't exist create it.
// you must create the file from the browser to associate the proper group
if (file_exists($cron_file)){ // if it exists, write new command
$open = fopen($cron_file, "w"); // This overwrites current line
fwrite($open, $command);
fclose($open);
// this will reinstate your Cron job
exec("crontab $cron_file");
} else { // if it Doesn't exist, Create it then write command
touch($cron_file); // create the file, Directory "cron" must be writeable
chmod($cron_file, 0777); // make new file writeable
$open = fopen($cron_file, "w");
fwrite($open, $command);
fclose($open);
// start the cron job!
exec("crontab $cron_file");
}
}
|