Welcome Guest, Not a member yet? Register   Sign In
How to schedule script execution
#1

[eluser]lolmann[/eluser]
I'm looking for a way to schedule execution of a controller/method ahead of time.

I know, there are cron jobs. (See this article for scheduling cron jobs using the command line.) The problem with cron jobs is that (as far as I know) I cannot schedule them dynamically. I want the execution date to be pulled from a mysql table. In other words, my client has to be able to schedule the event but I don't want him to set up cron jobs manually. I want my application to be able to schedule an event.

I found another interesting article on how wordpress manages scheduled events. Every time somebody calls a page wordpress checks if there are any scheduled tasks and executes them.

This looks like a good solution to me.

Has anybody done anything like this before?
Am I on the right track or are there better ways to do it?
Are there important things I have to keep in mind when implementing the wordpress solution?
#2

[eluser]ram4nd[/eluser]
You can run cron. In times and see if the time is there yet. But I think the wordpress solution is better.
#3

[eluser]lolmann[/eluser]
[quote author="ram4nd" date="1286727426"]You can run cron. In times and see if the time is there yet.[/quote]

Good idea, i hadn't thought of that. Just tell a cron to call a script every minute or so. The script checks for events that must be executed.




Theme © iAndrew 2016 - Forum software by © MyBB