MyBB Community Forums
[For 1.8] Enable Systemd Timers to Handle MyBB Task System - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: Tutorials (https://community.mybb.com/forum-38.html)
+--- Thread: [For 1.8] Enable Systemd Timers to Handle MyBB Task System (/thread-211078.html)



Enable Systemd Timers to Handle MyBB Task System - kawaii - 06-17-2017

Create the following two files in your /etc/systemd/system/ directory:

/etc/systemd/system/mybb.service
[Unit]
Description=MyBB Tasks

[Service]
User=www-data
ExecStart=/usr/bin/php /var/www/mybb/task.php

/etc/systemd/system/mybb.timer
[Unit]
Description=Runs MyBB tasks every minute

[Timer]
OnBootSec=5min
OnUnitActiveSec=1min
Unit=mybb.service

[Install]
WantedBy=multi-user.target

Now, run the following commands in your terminal:
systemctl daemon-reload
systemctl enable mybb.timer
systemctl start mybb.timer



RE: Enable Systemd Timers to Handle MyBB Task System - WallBB - 06-18-2017

I am not familiar with systemd tasks, I want to know will it not require any admin authentication to run tasks ?


RE: Enable Systemd Timers to Handle MyBB Task System - kawaii - 06-18-2017

No authentication needed at all, the /task.php file is executed as the system user you specify in the mybb.service file (User=www-data).


RE: Enable Systemd Timers to Handle MyBB Task System - andrewjs18 - 08-12-2018

don't forget to remove this from the footer template or adjust the comment so it comments out {$task_image} as well:

<!-- The following piece of code allows MyBB to run scheduled tasks. DO NOT REMOVE -->{$task_image}<!-- End task image code -->


RE: Enable Systemd Timers to Handle MyBB Task System - andrewjs18 - 08-17-2018

This is working well. thanks, kawaii!


RE: Enable Systemd Timers to Handle MyBB Task System - Wires - 08-17-2018

Nicely done, should probably explain why this may be preferred over MyBB's Crons Toungue


RE: Enable Systemd Timers to Handle MyBB Task System - Wildcard - 08-19-2019

Bumping this to say that I finally got around to doing this and I should've done it long ago.

@kawaii is the best! Smile