debian下supervisor安装配置
2015-01-16 15:56
169 查看
debain下安装配置supervisor
1.安装supervisorroot@debian-lege-pro:~# apt-get install supervisor Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: python-medusa python-meld3 Suggested packages: python-medusa-doc The following NEW packages will be installed: python-medusa python-meld3 supervisor 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 296 kB of archives. After this operation, 1,278 kB of additional disk space will be used. Do you want to continue [Y/n]?
2.查看配置文件在/etc/spuervisor下
root@debian-lege-pro:~# cd /etc/supervisor/ root@debian-lege-pro:/etc/supervisor# ls conf.d supervisord.conf
其中conf.d是一个子目录,其中存放着supervisor监管的进程的配置信息,一个进程有一个对应的配置文件;supervisord.conf是supervisor的主配置文件,定义服务名称以及接口等等。
3.编写监控脚本
root@debian-lege-pro:/etc/supervisor# cd conf.d/ root@debian-lege-pro:/etc/supervisor/conf.d# ls README root@debian-lege-pro:/etc/supervisor/conf.d# vim jiaoben.conf [program:jiaoben.py] #程序的名字,在supervisor中可以用这个名字来管理该程序。 user=root #指定运行用户 command=/home/jiaoben.py #启动程序的命令 autorstart=true #设置改程序是否虽supervisor的启动而启动 directory=/home/lege #相当于在该目录下执行程序 autorestart=true #程序停止之后是否需要重新将其启动 startsecs=5 #重新启动时,等待的时间 startretries=100 #重启程序的次数 redirect_stderr=true #是否将程序错误信息重定向的到文件 stdout_logfile=/home/lege/supervisor_log/log.txt #将程序输出重定向到该文件 stderr_logfile=/home/lege/supervisor_log/err.txt #将程序错误信息重定向到该文件 保存文件,配置完成。
4.使配置更改生效
每次修改主配置文件或增改子配置文件都需要执行supervisorctl update使新配置生效。或者用supervisorctl reload重新重新启动supervisor程序。
5.修改主配置文件
root@debian-lege-pro:vim /etc/supervisor/supervisord.conf [inet_http_server] port = 192.168.170.137:9001 #IP和绑定端口 username = root #管理员名称 password = 123456 #管理员密码
这样,在浏览器中输入配置中写的地址和端口号,输入配置好的用户名和密码,便可以看到基于网页的控制台界面。从中,可以察看supervisor监控的>信息,可以察看进程的日志等。
6.一定要指定user用户否则会运行报错的,如下:
root@debian-lege-pro:/home# supervisorctl update error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib/python2.7/socket.py line: 224
关键在于配合服务使用,而且脚本要编写正确,在浏览器中输入配置中写的地址和端口号,输入配置好的用户名和密码,便可以看到基于网页的控制台界面。从中,可以察看supervisor监控的>信息,可以察看进程的日志等。
相关文章推荐
- SVN 在Debian/Ubuntu、windows 2003 的配置安装与使用
- Debian下Fcitx的简单安装与配置
- Debian下PHP扩展的Tokyo Tyrant安装配置及测试
- 在debian下安装配置tftp服务器
- debian安装和配置
- Debian安装jdk及配置Java environment
- 利用虚拟机安装并配置Debian Linux系统的总结
- Debian Lenny英文版安装后配置
- debian+postfix+dovecot+squirrelmail安装配置笔记
- DEBIAN 下安装nfs服务器以及配置简单方法(做了些修改)
- Debian Linux上ssh的安装配置微调:
- debian安装好以后终端的配置的修改
- Debian Lenny英文版安装后配置
- Debian或Ubuntu下squid的安装与基本配置(已验证) - [服务器区]
- Debian下安装配置Java环境
- debian下中文输入法安装和配置
- Debian下安装配置ATI驱动
- Debian或Ubuntu下squid的安装与基本配置(已验证)
- Debian Lenny (Testting) 安装后配置(转)
- Debian3.1sarge下载安装配置中文环境