i have few commands in my laravel production app.
php artisan serve
php artisan queue:work
php artisan roulette:color
php artisan roulette:even
i am using vpn with ubuntu custom host
right now i am making 4 different screen for running these commands which is run forever
but sometime few crash don't know why and i have to find again which screen have crashed command
i am seeking is there any manager that can manage my commands easily
thank you
you don't need to make 4 different screens, just run:
nohup php artisan queue:work --daemon &
this will prevent the command exiting when you log out. the trailing ampersand (&) causes process starts in the background, so you can continue to use the shell and do not have to wait until the script is finished.
you can run any shell command in the background by adding the &
to the end:
nohup php artisan serve &
Supervisor is a process monitor for the Linux operating system, and will automatically restart your queue:work
process if it fails. To install Supervisor on Ubuntu, you may use the following command:
sudo apt-get install supervisor
create laravel-worker.conf
in the /etc/supervisor/conf.d
directory:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/laravel-example/artisan queue:work sqs --sleep=3 --tries=3
autostart=true
autorestart=true
user=forge
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/laravel-example//storage/logs/supervisord.log
stopwaitsecs=3600
you can see Supervisor: A Process Control System and Supervisor Configuration in Laravel doc for more info