On distributions with systemd (e.g. Ubuntu), it's also possible to create a system service without installing anything. Here's an example:
/etc/systemd/system/flarum-queue.service
[Unit]
Description=flarum-queue
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
User=deploy
WorkingDirectory=/var/www/flarum
ExecStart=/usr/bin/php flarum queue:work
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Then, once:
sudo systemctl start flarum-queue
sudo systemctl enable flarum-queue