- Building RESTful Web services with Go
- Naren Yellavula
- 230字
- 2021-07-02 20:14:06
Installing supervisord
We can easily install supervisord on Ubuntu 16.04, with the apt-get command:
sudo apt-get install -y supervisor
This installs two tools, supervisor and supervisorctl. supervisorctl is intended to control the supervisord and add tasks, restart tasks, and so on.
On macOS X, we can install supervisor using the brew command:
brew install supervisor
Now, create a configuration file at:
/etc/supervisor/conf.d/goproject.conf
You can add any number of configuration files, and supervisord treats them as separate processes to run. Add the following content to the preceding file:
[supervisord]
logfile = /tmp/supervisord.log
[program:myserver]
command=$GOPATH/bin/romanserver
autostart=true
autorestart=true
redirect_stderr=true
By default, we have a file called .supervisord.conf at /etc/supervisor/. Look at it for more reference. In macOS X, the same file will be located at /usr/local/etc/supervisord.ini.
Coming to the preceding configuration:
- The [supervisord] section tells the location of the log file for supervisord
- [program:myserver] is the task block which traverses to the given directory and executes the command given
Now we can ask our supervisorctl to re-read the configuration and restart the tasks (process). For that, just say:
- supervisorctl reread
- supervisorctl update
Then, launch supervisorctl with the command:
supervisorctl
You will see something like this:
supervisorctl is a great tool for controlling supervisor programs.
Since we named our romanserver myserver in the supervisor configuration file, we can start, stop, and restart that program from supervisorctl.
- 通信網(wǎng)絡(luò)基礎(chǔ)與設(shè)備
- 異構(gòu)基因共表達(dá)網(wǎng)絡(luò)的分析方法
- 5G承載網(wǎng)網(wǎng)絡(luò)規(guī)劃與組網(wǎng)設(shè)計(jì)
- PLC、現(xiàn)場總線及工業(yè)網(wǎng)絡(luò)實(shí)用技術(shù)速成
- Mastering Dart
- The Kubernetes Workshop
- Echo Quick Start Guide
- 4G小基站系統(tǒng)原理、組網(wǎng)及應(yīng)用
- 物聯(lián)網(wǎng)與智能家居
- INSTANT LinkedIn Customization How-to
- 設(shè)備監(jiān)控技術(shù)詳解
- bash網(wǎng)絡(luò)安全運(yùn)維
- 精通SEO:100%網(wǎng)站流量提升密碼
- 走近2050:注意力、互聯(lián)網(wǎng)與人工智能
- 5G低功耗蜂窩物聯(lián)網(wǎng)開發(fā)與應(yīng)用