Skip to content

Instantly share code, notes, and snippets.

@harshadyeola
Last active June 22, 2016 11:43
Show Gist options
  • Save harshadyeola/34315bdfc15e55025d945c2245963266 to your computer and use it in GitHub Desktop.
Save harshadyeola/34315bdfc15e55025d945c2245963266 to your computer and use it in GitHub Desktop.

About

To run your script/worker continuously you can use the supervisor.

Install Supervisor

apt-get install supervisor

Configure Supervisor Program

Run your worker as daemon with supervisor make sure your that your configuration looks like worker.conf below

Start Worker

$supervisorctl
supervisorctl> start worker

Stop Worker

$supervisorctl
supervisorctl> stop worker

Know Status of your worker

supervisorctl status worker
# Path for the file is
# /etc/supervisor/conf.d/worker.conf
[program:worker]
user=www-data
command=/path/to/worker.php
startretries=10
autostart=true
autorestart=true
stderr_logfile=/var/log/worker.err.log
stdout_logfile=/var/log/worker.out.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment