|
Posted by Marek Kilimajer on 01/29/05 22:04
John Nichel wrote:
> Chris W. Parker wrote:
>
>> Hello,
>>
>> I'm looking to make a simple scheduler for myself and I'd like to get
>> some feedback on how to handle the events and their being executed at
>> the right time.
>>
>> The two options I've come up with both involve adding a job(s) to
>> crontab.
>>
>> 1. Individual jobs are added to the users crontab file. This could
>> result in LOTS of entries in crontab, but less load on the server.
>>
>> 2. There is one job put in the crontab file that is executed every five
>> minutes. This job will be executing a PHP file that runs through the
>> database for the current user and checks to see if any events need to go
>> off at that time. This will result in only one event in crontab with a
>> greater potential for load on the server.
>>
>>
>> I'm leaning towards Option 2*. What do you think? What other options do
>> I have?
>
>
> I'd go with option 2 also. Option one wouldn't really be less load, as
> it would be more for cron to parse, and pretty much execute the same
> amount of times.
Option 2 needs cron too, and the parsing is done by php instead of cron,
so this is not really valid point.
> Option 1 also brings into question security and
> access. To add entries to the users crontab, your script would have to
> have permission to do so (suexec?), and giving it that much access could
> be dangerous.
This is a valid point if php scripts are executed as apache user.
What about option 3:
Use at command to execute php script when the next event should be
executed. This php script will execute this task and then set itself to
execute at the time of the next event.
Navigation:
[Reply to this message]
|