Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mohamad-supangat/7338ad5d9a5d70535b2aa88f5de69e35 to your computer and use it in GitHub Desktop.
Save mohamad-supangat/7338ad5d9a5d70535b2aa88f5de69e35 to your computer and use it in GitHub Desktop.
How to run laravel Schedule and Queue with Supervisor

How to run laravel Schedule and Queue with Supervisor

Create supervisor config file for laravel

nano /etc/supervisor/conf.d/laravel-worker.conf

laravel-worker.conf

[program:laravel-queue]
process_name=%(program_name)s_%(process_num)02d
directory=/home/laravel
command=php artisan queue:work --queue=high,default --sleep=5 --tries=3 --timeout=60 --delay=5
autostart=true
autorestart=true
user=developer
numprocs=4
redirect_stderr=true
stdout_logfile=storage/logs/queue.log
stopwaitsecs=3600

[program:laravel-schedule]
process_name=%(program_name)s_%(process_num)02d
directory=/home/laravel
command=/bin/sh -c "while [ true ]; do (php artisan schedule:run --verbose --no-interaction &); sleep 60; done"
autostart=true
autorestart=true
user=developer
numprocs=1
redirect_stderr=true
stdout_logfile=storage/logs/laravel-schedule.log
stopwaitsecs=3600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment