We can keep running of Laravel queue server using pm2.
- Create a pm2 config file
nano ecosystem.config.js
- Update the config file
module.exports = {
apps: [
{
name: 'laravel-queue',
script: 'artisan',
args: 'queue:work --sleep=3 --tries=3 --max-time=3600',
instances : 1,
exec_mode : 'fork',
interpreter: '/usr/bin/php',
autorestart: true,
watch: false,
max_memory_restart: '100M',
error_file: './storage/logs/queue.error.log',
out_file: './storage/logs/queue.out.log',
pid_file: './storage/logs/queue.pid.log',
cwd: "/var/www/api",
},
],
};
- Start the process
pm2 start laravel-queue