Warning: Undefined array key "argon_user_token" in /app/yubanmei.com/wp-content/themes/argon/functions.php on line 339

Warning: Cannot modify header information - headers already sent by (output started at /app/yubanmei.com/wp-content/themes/argon/functions.php:339) in /app/yubanmei.com/wp-content/themes/argon/functions.php on line 341

Warning: session_start(): Session cannot be started after headers have already been sent in /app/yubanmei.com/wp-content/themes/argon/functions.php on line 346
supervisor 的安装与使用 – 御坂妹
supervisor 的安装与使用

linux的后台进程运行有好几种方法,例如nohup,screen等,但是,如果是一个服务程序,要可靠地在后台运行,我们就需要把它做成daemon,最好还能监控进程状态,在意外结束时能自动重启。

supervisor就是使用python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动重启。

centos安装supervisor:

yum install python-setuptools
easy_install supervisor

echo_supervisord_conf > /etc/supervisord.conf
//生成配置文件

vim /etc/supervisord.conf
//在supervisord.conf最下面新增配置
------
[program:bandwidth]
command=python26 /usr/local/bin/bandwidth.sh
//需要执行的命令
user =root
//(default  is  current  user , required  if  root)
autostart=true
//start at supervisord start (default: true)
autorestart=true
//whether/when to restart (default: unexpected)
startsecs=3
//number of secs prog must stay running ( def . 1)
stderr_logfile=/tmp/bandwidth_err.log
//redirect proc stderr to stdout (default false) 错误输出重定向
stdout_logfile=/tmp/bandwidth.log
//stdout log path, NONE  for  none; default AUTO, log输出

//更多配置说明请参考:http://supervisord.org/configuration.html
------

supervisord -c /etc/supervisord.conf
//启动supervisor

Debian/Ubuntu 安装supervisor:

apt-get install supervisor
vim /etc/supervisor/conf.d/bandwidth.conf
//新增一个配置文件
------
[program:bandwidth]
command = python26 /usr/local/bin/bandwidth.sh
directory = /usr/local/bin/
user = root
autostart = true
autorestart = true
//配置同上,不过需要注意一定要有directory
------

supervisorctl update
supervisorctl start bandwidth

常用状态命令:

supervisorctl
//直接进入命令行模式
supervisorctl status
//查看运行状态
supervisorctl help
//查看帮助
supervisorctl reload
//重载配置文件
supervisorctl stop [name]
//停止运行[name]
supervisorctl start [name]
//开始运行[name]

//更多命令请参考:http://supervisord.org/
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇