Supervisor

Supervisor is a client/server system that allows its users to monitor and control several processes on UNIX-like operating systems. It is used to control processes related to a project or a customer and is meant to start like any other program at boot time. Features of Supervisor includes simple, centralized, efficient, extensible, compatible and proven.

You should use Supervisor on your web server for efficiency. Creating and deleting WireGuard configurations, auto installation of VPN protocols and many other functions use Queues to avoid server loads and provide a better experience for your users. Supervisor will handle the queues on the line much better and faster than Cron Jobs.

Supervisord Configuration

Once you have Supervisor installed on your server, you can use the example below to create your configuration.

[program:vpn-script-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /srv/yoursite/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/log/worker.log
stopwaitsecs=3600

Don't forget to update "/srv/yoursite/artisan" with your own artisan path

After saving your configuration file, you should start your Supervisor program.

sudo supervisorctl start vpn-script-worker:*

Last updated