Skip to content

Instantly share code, notes, and snippets.

@kawaii
Last active June 18, 2017 00:01
Show Gist options
  • Save kawaii/6bba3b0a523234185b6759af8ac7347d to your computer and use it in GitHub Desktop.
Save kawaii/6bba3b0a523234185b6759af8ac7347d to your computer and use it in GitHub Desktop.
How to setup systemd timers for your MyBB task system.

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

mybb.service:

[Unit]
Description=MyBB Tasks

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

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 order:

systemctl daemon-reload
systemctl enable mybb.timer
systemctl start mybb.timer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment