How to Use systemd to Manage Laravel Queue Workers
This article explains how to manage Laravel queue workers in production using systemd instead of the traditional Supervisor tool. Laravel queues require a process manager to keep them running continuously, as the default php artisan queue:work command eventually stops and needs to be restarted manually. While many developers use Supervisor to handle this, systemd is presented as a simpler and more native alternative that comes pre-installed on most Linux systems. The guide walks through creating a systemd service file, configuring it to restart automatically, run under the appropriate user, and start at system boot. It also shows how to reload systemd, enable and start the service, manage the worker with systemctl commands, and check logs with journalctl. The article further highlights how to scale up multiple workers using systemd templates. A comparison table outlines the benefits of systemd over Supervisor, including no extra installation, built-in logging, automatic restarts, easier scaling, and lower complexity. The conclusion emphasizes that while Supervisor works well, systemd offers a cleaner and more integrated solution for managing Laravel queues in production environments.
