Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

manoaratefy's avatar

Using queue:work with systemd - service restarted each ~10mn

Good morning,

I implemented queue:work using systemd with following configuration file:

[Unit]
Description=My Laravel Project

[Service]
User=root
Type=simple
ExecStart=/opt/alt/php74/usr/bin/php -d extension=pdo.so -d extension=pdo_mysql.so -d extension=pdo_sqlite.so -d extension=json.so -d extension=phar.so /usr/local/mylaravelproject/artisan queue:work --timeout=21600 --daemon
Restart=on-failure

At this time, the service is restarted each ~10mn (seems to be a timeout). But when running the command directly on terminal, it never exits.

The journalctl -u myservice show following log:

Mar 05 16:37:34 myserver systemd[1]: Started My Laravel Project.
Mar 05 16:50:01 myserver systemd[1]: myservice.service: main process exited, code=killed, status=9/KILL
Mar 05 16:50:01 myserver systemd[1]: Unit myservice.service entered failed state.
Mar 05 16:50:01 myserver systemd[1]: myservice.service failed.
Mar 05 16:50:02 myserver systemd[1]: myservice.service holdoff time over, scheduling restart.
Mar 05 16:50:02 myserver systemd[1]: Stopped My Laravel Project.
Mar 05 16:50:02 myserver systemd[1]: Started My Laravel Project.

Any ideas why it is restarting again and again?

0 likes
2 replies
marbobo's avatar

Hi, I use the same (systemd) on my production server using ubuntu. Maybe the issue is with the user or group. maybe try adding a group on your worker config. I also notice the --daemon option. I am not familiar with it so I check it. and base on the php artisan queue:work --help it says deprecated. maybe thats the cause of the issue. since this is a process already i think you dont need to include --daemon option

manoaratefy's avatar

I already tried without --daemon, same problem. Also, I really need to run the process as root because my queued jobs is made to change system configuration files.

Please or to participate in this conversation.