MyBB Community Forums

Full Version: Task Manager as CRON job
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The task manager is reliant upon users refreshing pages on the forum for very busy forums that do not have many immediate tasksĀ this is not really an issue however for some forums with light traffic and immediate jobs this can cause a problem. The solution would be to have tasks run in a CRON job as part of the forum standard core functionality. Or at the very least have this as a standard optional install...
Cron jobs have to be manually set the administrator, there's no way for MyBB to create them.
However scheduled tasks will be runnable as an Artisan task, so they could be ran from cron or via Systemd timers (which is my personal preference these days, see below for an example)

[Unit]
Description=Run MyBB 2.0
After=mysql.service

[Service]
User=http
ExecStart=/usr/bin/php /sites/www/artisan schedule:run

[Unit]
Description=Run MyBB scheduled tasks every 1 minute

[Timer]
OnBootSec=1min
OnUnitActiveSec=1m

[Install]
WantedBy=timers.target
The mechanism to schedule tasks varies greatly bu OS. Tutorials should be written on how to set them up, but implementing should be left to the sysadmin.