The following will explain how to install and configure supervisor on Ubuntu
if you have a long running service that you want to activate on linux, say an apache web server, a jupyter notebook service,etc.. then you would want to have that service run and monitored by supervisor
Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.
It shares some of the same goals of programs like launchd, daemontools, and runit. Unlike some of these programs, it is not meant to be run as a substitute for init as “process id 1”. Instead it is meant to be used to control processes related to a project or a customer, and is meant to start like any other program at boot time.
Move to /etc/supervisor/conf.d folder
start to write and create new file
and then follow this pattern for supervisor configuration
if you have a long running service that you want to activate on linux, say an apache web server, a jupyter notebook service,etc.. then you would want to have that service run and monitored by supervisor
Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.
It shares some of the same goals of programs like launchd, daemontools, and runit. Unlike some of these programs, it is not meant to be run as a substitute for init as “process id 1”. Instead it is meant to be used to control processes related to a project or a customer, and is meant to start like any other program at boot time.
Installing Supervisor
to install supervisor, simply put this commandsudo apt-get install supervisor
Running Supervisor
To run, stop, and check supervisor status, use this commandsudo service supervisor start sudo service supervisor stop sudo service supervisor status
Adding a program to Supervisor
All program that you want to run on Supervisor will need to be added to configuration, Supervisor has all the configuration on /etc/supervisor/conf.d. To add a program simply create a new .conf configuration fileMove to /etc/supervisor/conf.d folder
cd /etc/supervisor/conf.d
start to write and create new file
nano sample.conf
and then follow this pattern for supervisor configuration
[program:sample] command=/usr/bin/python3 /usr/local/bin/jupyterhub --port 9060 --ip 192.168.0.1 autostart=true autorestart=true stderr_logfile=/var/log/jupyterhub.err.log stdout_logfile=/var/log/jupyterhub.out.logThis configuration file will simply do the following
- register a new process called "sample" which runs command to activate jupyterhub
- set the process to autostart and autorestart (the default is false)
- and set the stderr_logfile and stdout_logfile location, this will put everything that shows on screen to a file when you run the command directly in console
sudo supervisorctl reread sudo supervisorctl updateand then you can check the result by using
sudo supervisorctl status
No comments :
Post a Comment