# systemd unit for the WhatsApp CRM queue worker. # Install: # sudo cp deploy/whatsapp-worker.service /etc/systemd/system/whatsapp-worker.service # # edit User/WorkingDirectory/ExecStart paths below to match the server, then: # sudo systemctl daemon-reload # sudo systemctl enable --now whatsapp-worker # sudo systemctl status whatsapp-worker # # This replaces `php artisan queue:work ... &`, which dies when the SSH session # closes. systemd keeps it running and restarts it automatically on crash/reboot. [Unit] Description=WhatsApp CRM queue worker (webhooks + default) After=network.target [Service] Type=simple # --- adjust these three to the production server --- User=raitoai WorkingDirectory=/home/raitoai/public_html/whatsapp ExecStart=/usr/bin/php /home/raitoai/public_html/whatsapp/artisan queue:work --queue=webhooks,default --timeout=600 --sleep=1 --tries=3 --max-time=3600 --rest=1 # --------------------------------------------------- Restart=always RestartSec=3 # Recycle the process every hour (--max-time) to release leaked memory; systemd restarts it. [Install] WantedBy=multi-user.target