I am wanting to add a section in my php application to add / remove scheduled tasks.
Something similar to what they use in vBulletin Forum.
Does anyone have any ideas what they use? Are they using cron jobs or do they have something custom done.
Can anyone guide me on how I can accomplish something similar to that, basically I just want my script to add or remove cron jobs / scheduled task.
I don't want to use, for example the cPanel Cron interface, I would like to accomplish this from within my script.
Any help is greatly appreciated.
If you don't have the exec()
function enabled, you have to rely on manually setting at least one cron job via some interface and then managing individual jobs in your script.
What I do for example is this
heartbeat.php
which is executed every minutecrontab
and checks if there is any row (job) with time_to_process <= NOW()
crontab
tablerun()
method and I only call $cronJob->run()
to make it runcrontab
table once it finishesA good example is to reset daily views on some items.
The job is scheduled at May 1, 2010 00:00. Once the job ran, it schedules itself for the next day automatically.
You can then implement automatic reset of failed jobs and many other features from within PHP.
http://ryanfaerman.com/php-crontab-manager/
is a php class that lets you access a crontab from PHP using a class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With