Skip to main content

Cron job setup

SolidInvoice uses a single background worker for both async messages (email, webhooks) and scheduled tasks (recurring invoices, reminders, overdue checks). The command is the same in every case:

bin/console messenger:consume --all --time-limit=3600 --memory-limit=128M

The platform-specific configurations below are alternative ways to keep that command running. Pick whichever fits your environment.

warning

Without a worker running, async features and scheduled tasks won't fire โ€” emails won't send and recurring invoices won't generate.

info

You only need to set up a worker when running from the distribution package or from Git. The quick install, Homebrew, and Docker installs run the worker automatically.

Pick a platformโ€‹

A long-running systemd service is the most reliable option on a Linux server.

Create a unit file at /etc/systemd/system/solidinvoice-worker.service:

/etc/systemd/system/solidinvoice-worker.service
[Unit]
Description=SolidInvoice worker
After=network.target

[Service]
Type=simple
User=www-data
WorkingDirectory=/opt/solidinvoice
ExecStart=/usr/bin/php bin/console messenger:consume --all --time-limit=3600 --memory-limit=128M
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Reload, enable, and start it:

sudo systemctl daemon-reload
sudo systemctl enable --now solidinvoice-worker.service

For higher throughput, run multiple copies via a systemd template (solidinvoice-worker@.service) and start solidinvoice-worker@1, solidinvoice-worker@2, etc.

Verifying the worker is runningโ€‹

Tail the application log or check the messenger queue:

bin/console messenger:stats

A healthy setup keeps the queue counts low โ€” messages are processed within seconds (systemd) or up to a minute (cron).