Direct url to single job

Permalink 2 users found helpful
I have a site with 6 concrete5 jobs. The API is just create, simple but good enough to handle all my stuff.

However, there's one problem. I have to execute a job every 2 minutes, the rest every day to keep the server load low.

I could run the maintenance job every second minute, add some code to 5 jobs which checks the last time it run and I'm almost fine to go.

But that's a bit silly - I don't want to insert some scheduling code into 5 jobs.

Is there a way I can call a single job by my cron job?

Remo
 
ryan replied on at Permalink Best Answer Reply
ryan
Try adding a tools page with something like:

<?php
Loader::model('job');
if($_REQUEST['auth'] == 'my auth') {
  $job = Job::getJobObjByHandle('handle');
  $job->executeJob();
}
?>
Remo replied on at Permalink Reply
Remo
yes, that seems to be the best way to do it until there's a "direct job url" feature.

thanks!
energywave replied on at Permalink Reply
energywave
Hello Ryan, I'm trying that way but I get this error:
Fatal error: Class 'Loader' not found in /web/htdocs/<MYSITE>/home/tools/ProcessEmails.php on line 2

I'm missing something...? I don't know much about php...
energywave replied on at Permalink Reply
energywave
Ops! Ignore my message! I didn't noticed that now you can run a single job by adding jHandle=<JobHandle> or jID=<JobID> in the querystring of standard scheduled job url.
Now my problem is that my hosting allow only one cron job... but that's a different story! :)

Have a nire day!