Skip to content

Cron & queue

Production setup has two separate concerns:

ConcernRequired whenDoc section
CronAutomatic currency rate sync is enabled in adminScheduler
Queue workerQUEUE_CONNECTION=database and you use queued mail/jobsQueue workers

If you use neither automatic rates nor queued jobs, you can use QUEUE_CONNECTION=sync and skip the worker entirely.


Laravel scheduler (required for rate sync)

ExchangePro registers an hourly task in routes/console.php to sync currency prices when the feature is enabled in admin.

Cron entry

Add one line to the server crontab (crontab -e as the web user or root):

text
* * * * * cd /var/www/exchangepro/backend && php artisan schedule:run >> /dev/null 2>&1

Replace the path with your backend directory.

Verify scheduler

bash
php artisan schedule:list

You should see the hourly CurrencyRateSyncService callback.

Test manually

bash
php artisan schedule:run

Check admin currency prices or logs for sync activity.


Queue workers (optional)

Default .env:

ini
QUEUE_CONNECTION=database

Laravel creates a jobs table via migrations. For queued mail or heavy tasks, run a worker:

bash
php artisan queue:work --tries=3

Supervisor example

/etc/supervisor/conf.d/exchangepro-worker.conf:

ini
[program:exchangepro-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/exchangepro/backend/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/exchangepro/backend/storage/logs/worker.log
bash
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start exchangepro-worker:*

If you do not run a queue worker, keep QUEUE_CONNECTION=sync for immediate processing (simpler, fine for low traffic).


What does NOT require cron

FeatureMechanism
User sessionsDatabase / cookie lifetime
Exchange approvalAdmin manual action
Public rates displayRead from DB on request

Logs

LogPath
Laravelbackend/storage/logs/laravel.log
Queue workerSupervisor log path above
Nuxt / PM2PM2 or systemd journal

Monitor disk space on storage/logs in production.

Need help? support@xorinlab.com · Website: xorinlab.com