Skip to main content
Topic: How does scheduling work? (Read 2092 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How does scheduling work?

Hi, I have seen, that ElkArte has got several scheduled tasks and a mail queue can also be used. How are these tasks triggered? Usually you would create a cronjob, but this option isn't available for ElkArte.

Thanks!

Re: How does scheduling work?

Reply #1

Hello itsme and welcome. :)

The scheduled task are basically using a fake cron to overcome the limitation of shared hosting not providing access to cronjob.
The faking happens by either injecting some javascript calling index.php?scheduled or executing the script inline (usually when spiders visit the site).
Bugs creator.
Features destroyer.
Template killer.

Re: How does scheduling work?

Reply #2

Hi emanuele,

thanks for your answer! So this means, if you have got a forum with only minor traffic, the tasks may be not executed in time, right? I'm especially interested in the mail queue. I've got a shared hosting plan but can also setup cron jobs. Is it possible to setup a cron for the mail queue?

Thanks!

Re: How does scheduling work?

Reply #3

At the moment I don't remeber the specifics (and I'm in the bed sick, so I cannot even check... :( ).
Worst case you can set the cron to call curl on index.php?scheduled=1
Bugs creator.
Features destroyer.
Template killer.

Re: How does scheduling work?

Reply #4

Okay, thanks and get well! I checked the source code. There seems to exist a configuration option for running the mailqueue as a cronjob: $modSettings['mail_queue_use_cron']. I looked around in the admin section, but didn't find the screen where I could set this option. Any hints?

Re: How does scheduling work?

Reply #5

Maintenance → Mail → Settings → Enable mail queue (plus max per minute)

Re: How does scheduling work?

Reply #6

As far as I understand, this enables only the mail queue itself. Per default the script which works on the queue items it not started by cron.

Re: How does scheduling work?

Reply #7

Oh sorry, I didn't read carefully enough. So just do what @emanuele suggested? Just hit the relevant URL with curl through cron. :P

Re: How does scheduling work?

Reply #8

I want to run the script for the mail queue every 5 minutes. To avoid overhead by checking all other tasks that often too, I created now a special cron php file for that job (a modified email_imap_cron.php). Additionally I added manually "mail_queue_use_cron=1" to the settings table to avoid that the fake cron is also working on the mail queue.

Re: How does scheduling work?

Reply #9

The other tasks if are not meant to be sent are not executed, so there is no overhead.
If you want to run only the mail, then you can use ?index.php?scheduled=mailq
that is specifically designed to go through the mail queue only, it is actually the best way to do it.
Bugs creator.
Features destroyer.
Template killer.

Re: How does scheduling work?

Reply #10

Thanks. That's what I were looking for  :) . I'll set it up that way.