Considering: NP_Sheduler

Like i said, i'm thinking about writing a plugin that can be used as a tasksheduler: NP_Sheduler.
This is how i plan to do it (please comment! does it make sense at all?):

  • The plugin will execute 'task-scripts' at a certain time. These taskscripts are just php files with a name like task_foobar.php and a function start_task() to start the task. These file will be dropped in the 'tasks'-folder inside the 'sheduler'-folder, so that the plugin can 'scan' this folder to find new taskscripts. Other plugin could then 'drop-in' taskscripts when they are installed (well just unzipped ofcourse), and after that the user will be able to make a task for the new script, by selecting the task-script from the list and plan it
  • The plugin subscribes to the very last event, to check if there are tasks to be done (checks the current timestamp with the calculated 'next-run'-timestamp of every task, if current is > nextrun -> run the task), and if so includes the appropriate task_scripts and calls the start_task()-function.
  • To store the time of the tasks in the database i'll use unix-notation (the one found in CPanel > cronjobs > avanced (unix notation)
  • after a task has been run the plugin computes the timestamp for the next run and stores this in the database (so that it can be compared with the current timestamp in the event).

Comments

Avatar

TeRanEX on 2004-08-09 13:46 reply

no i only use one to send the

no i only use one to send the newsletter every day... But there might be other uses for it IMHO, like euhm... by example automatically truncate the table of the referers plugin or so...

Avatar

hcgtv on 2004-08-09 19:13 reply

I use cron jobs, awstats

I use cron jobs, awstats update: every 15 minutes, Miami weather update: every hour.

Avatar

admun on 2004-08-09 22:54 reply

some comment: - I'm not sure

some comment:
- I'm not sure if scanning the script folder and execute them is a good idea. What if someone able to hack the server and inject a nasty php file there? I think it might be better to have a task registration mechanism that when a plugin is installed and called if it need batch/cron function. The information is saved in a table.
- How to trigger the task on a specify time? If the plugin using a event as trigger, there is not 100% that a job is exec on a specified time, only able to exec the tasks the 1st hit to the blog on/after the specified time... not really bad, but not exactly what ppl expected?

Avatar

TeRanEX on 2004-08-10 00:27 reply

@admun: "- I'm not sure if

@admun:
"- I'm not sure if scanning the script folder and execute..."
You might have a point but isn't that a bit the same problem as when somebody is able to hack the server and lets say replace admin.php with his own version? or is adding file easier then replacing? (i'm not a cracker)
"- ... only able to exec the tasks the 1st hit to the blog on/after the specified time... "
Indeed, it will be executed as soon as possible when the exectime has actually passed

Avatar

TeRanEX on 2004-09-09 20:20 reply

That's why i didn't found

That's why i didn't found 'sheduler' at dictionary.com :D
Maybe i'll change the name ;-) But i fact sheduler looks nicer IMHO :-p

Comment Atom Feed