Tags

, ,

Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.

More info at http://supervisord.org/

Under the /etc/supervisor/conf.d/ folder, create a file example mysite.conf

[program:myapp]
command=node /var/www/myapp/bin/www
directory=/var/www/myapp
autostart=true
autorestart=true
user=johndoe
process_name=myapp
stdout_logfile=/var/log/myapp.log
redirect_stderr=true
environment=
  PORT=3004
...
$ sudo supervisorctl 
PROCESS1   RUNNING   pid 7684, uptime 13:08:23
PROCESS2   FAILED    pid 6614, uptime 13:08:23
...
supervisor>restart PROCESS2
$ sudo supervisorctl status
PROCESS1   RUNNING   pid 7684, uptime 13:08:23
PROCESS2   RUNNING   pid 6614, uptime 13:08:23
...
$ sudo supervisorctl reread
myapp: available

$ sudo supervisorctl update
myapp: added process group
Advertisements