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.
Without a worker running, async features and scheduled tasks won't fire โ emails won't send and recurring invoices won't generate.
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โ
- systemd
- Supervisord
- Linux cron
- cPanel
- Plesk
- Windows
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:
[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.
Use Supervisord on systems without systemd (or when your stack already manages other services with it).
Create a program file at /etc/supervisor/conf.d/solidinvoice-worker.conf:
[program:solidinvoice-worker]
command=/usr/bin/php /opt/solidinvoice/bin/console messenger:consume --all --time-limit=3600 --memory-limit=128M
user=www-data
numprocs=1
process_name=%(program_name)s_%(process_num)02d
autostart=true
autorestart=true
startsecs=5
startretries=10
stopasgroup=true
killasgroup=true
stopwaitsecs=30
stdout_logfile=/var/log/supervisor/solidinvoice-worker.log
stderr_logfile=/var/log/supervisor/solidinvoice-worker.err.log
Reload Supervisord and start the worker:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start solidinvoice-worker:*
Increase numprocs to run multiple workers in parallel โ Supervisord will append the process number to process_name automatically.
stopwaitsecs=30 gives the worker time to finish the message it's currently handling before being killed. Keep it higher than the slowest message you expect to process.
Use cron when you can't run a long-running service (for example on shared hosting that blocks daemons). The --time-limit=55 flag makes the worker self-terminate before the next cron tick:
* * * * * /usr/bin/php /opt/solidinvoice/bin/console messenger:consume --all --limit=10 --time-limit=55 --memory-limit=128M
This approach introduces up to a 60-second delay before async messages and scheduled tasks start processing. For most self-hosted setups this is fine โ but use the systemd option if you have it.
Replace /opt/solidinvoice with the actual path to your installation.
-
Log in to cPanel.
-
Go to Advanced โ Cron Jobs.
-
Add a new cron job:
-
Common Settings:
Once per minute (* * * * *) -
Command:
/usr/bin/php /home/yourusername/path/to/solidinvoice/bin/console messenger:consume --all --limit=10 --time-limit=55 --memory-limit=128M
-
-
Save.
Replace /home/yourusername/path/to/solidinvoice with the actual path to your installation.
-
Log in to the Plesk panel.
-
Go to Tools & Settings โ Scheduled Tasks (or Scheduled Tasks under your domain).
-
Click Add Task and configure:
-
Task type: Run a command
-
Run:
Cron style โ * * * * * -
Command:
/usr/bin/php /path/to/solidinvoice/bin/console messenger:consume --all --limit=10 --time-limit=55 --memory-limit=128M
-
-
Save the task.
Use Task Scheduler to run the worker every minute.
-
Open Task Scheduler and select Create Task.
-
General โ name the task
SolidInvoice worker. -
Triggers โ add a new trigger:
- Begin the task: On a schedule
- Daily, recur every
1day - Repeat task every:
1 minutefor a duration ofIndefinitely
-
Actions โ add a new action:
-
Action: Start a program
-
Program/script:
php.exe -
Add arguments:
C:\path\to\solidinvoice\bin\console messenger:consume --all --limit=10 --time-limit=55 --memory-limit=128M
-
-
Save the task.
Replace C:\path\to\solidinvoice with the actual path to your installation.
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).