|
| 1 | +# Install Supervisor and Manage Process |
| 2 | + |
| 3 | +## Installation |
| 4 | +``sh |
| 5 | +sudo apt-get install supervisor |
| 6 | +`` |
| 7 | +## Goto /etc/supervisor/conf.d folder, supervisor create this folder in your system |
| 8 | +``sh |
| 9 | +cd /etc/supervisor/conf.d |
| 10 | +`` |
| 11 | +## Make a file `touch filename.conf`, make sure file name end with `.conf` |
| 12 | +- You may need permission to create a file or use every time prefix `sudo` |
| 13 | +- `sudo touch filename.conf` |
| 14 | +- If don't want use sudo give permission folder |
| 15 | +- `sudo chmod -R 777 conf.d` |
| 16 | + |
| 17 | +## Add React App in Supervisor [frontend](frontend.conf) |
| 18 | +```sh |
| 19 | +[program:frontend] |
| 20 | +directory="project directory" |
| 21 | +command=npm start |
| 22 | +autostart = true |
| 23 | +autorestart=true |
| 24 | +stderr_logfile=/var/log/test.err.log |
| 25 | +stdout_logfile=/var/log/test.out.log |
| 26 | +``` |
| 27 | +- After write filename.conf file need following command for start |
| 28 | +- `sudo supervisorctl reread` |
| 29 | +- `sudo supervisorctl update` |
| 30 | + |
| 31 | +## Lets Check Supervisor Process |
| 32 | +- `sudo supervisorctl` |
| 33 | + |
| 34 | +## See Log of Supervisor Running Process |
| 35 | +- `tail /var/log/test.err.log` |
| 36 | +- `tail /var/log/test.err.log` |
| 37 | + |
| 38 | +## Optionally, If More conf.d file write config file for run all of process |
| 39 | +```sh |
| 40 | +; supervisor config file |
| 41 | +[unix_http_server] |
| 42 | +file=/var/run/supervisor.sock ; (the path to the socket file) |
| 43 | +chmod=0700 ; sockef file mode (default 0700) |
| 44 | + |
| 45 | +[supervisord] |
| 46 | +logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) |
| 47 | +pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) |
| 48 | +childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) |
| 49 | + |
| 50 | +; the below section must remain in the config file for RPC |
| 51 | +; (supervisorctl/web interface) to work, additional interfaces may be |
| 52 | +; added by defining them in separate rpcinterface: sections |
| 53 | +[rpcinterface:supervisor] |
| 54 | +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface |
| 55 | + |
| 56 | +[supervisorctl] |
| 57 | +serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket |
| 58 | + |
| 59 | +; The [include] section can just contain the "files" setting. This |
| 60 | +; setting can list multiple files (separated by whitespace or |
| 61 | +; newlines). It can also contain wildcards. The filenames are |
| 62 | +; interpreted as relative to this file. Included files *cannot* |
| 63 | +; include files themselves. |
| 64 | + |
| 65 | +[include] |
| 66 | +files = /etc/supervisor/conf.d/*.conf |
| 67 | +``` |
| 68 | +## See [Supervisor](http://supervisord.org) for more details |
0 commit comments