.: PHP JobScheduler 1.2 :.
|
|
Download: PHP Jobscheduler [ 30-11-2005 ] 25.5 kB
Globals OFF compat. |
If you have no access to CRON.
As i have no acces to cron on the server i by accident found the solution
by SEIRETTO.
This is a solution based as the origine of BiTLOG call a php script via any
Html file one the server.
The basics.... If you have enough visitors on your website this will be enough
to trigger tasks on the server within a certain timeframe.
In html this can be achieved with the infamous 1x1 pixel graphic that calls
a PHP script.
In php you can call phpjobscheduler.php direct.
If you use BiTLOG you can even do it more gentle by including phpjobscheduler
in the bottom of
bits.php or bit_include.php.
What can i set?
You can set trigger times per:
- Hour (any 1-24 hour interval)
- Days (any 1-31 days interval with preferred execution hour)
- Weeks (any 1-53 weeks interval with preferred execution day and hour)
- Month on the 1st,2nd,3rd or last day.
- Send email after execution of job.
Many changes I added to make it all as complete as possible. Now its great
to run backup jobs.
Any visitor might start (trigger) a job, they won't know.
They job is executed and the new time is set.
Do not install phpjobscheduler levels deep, just directory /phpjobscheduler
will do.
(otherwise tasks might crash, or you have to change the script).
in html:
<img src="/jobscheduler/jobscheduler.php?return=1"
width=1 height=1 border=0>
This is the preferred method as it runs and does not delay loading of
any page.
|
in PHP:
include ("/phpjobscheduler/phpjobscheduler.php");
Or include in bit_include.php if you use bitlog. (Might delay page
load)
|
The idea by Seiretto was great and just needed a touch-up.
Conciderations: If you include phpjobscheduler.php and the job takes a very
long time to run it might delay the page for as long as the jobs run, imagine
a websitebackup that takes 3-4 minutes.....
Therefor on xxNIX you also can start the jobs with php exec() and than run them
in the background.
The scripts should not have any output to screen (although can send to /null).
But not everybody has access to exec().
for sample to run backup.php:
exec("/usr/local/bin/php /path/to/backup.php > /dev/null &");
& says run in background > redirects output to dev/null (nowhere)
This way the backup will finish in the background and the viewer will notice
nothing.
If you include the 'pixel' method it will
probably give no problems, because the grabbing of the picture might time-out.
That's all.
Two things to mention:
a. protect phpjobscheduler with .htaccess and use fire_jobscheduler.php to launch
jobscheduler.
b. you include the jobs to do if you dont use exec, make sure all path's are
correctly mentioned and if necessairy use chdir() in the script you start, to
set it to the script dir!
|