supervisor 安装脚本
mkdir /data/tools && cd /data/tools
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
sudo python ez_setup.py --insecure
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
tar -xf pip-9.0..tar.gz
cd pip-9.0.
sudo python setup.py install
sudo easy_install supervisor
sudo mkdir /etc/supervisor
sudo mkdir /etc/supervisor/conf
sudo chown wwwad.wwwad /etc/supervisor/ -R
echo_supervisord_conf > /etc/supervisor/supervisord.conf
mkdir /data/supervisor/
supervisord.conf 配置文件内容为
; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Notes:
; - Shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
; - Quotes around values are not supported, except in the case of
; the environment= options as shown below.
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
; - Command will be truncated if it looks like a config file comment, e.g.
; "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ". [unix_http_server]
file=/data/supervisor/supervisor.sock ; the path to the socket file
chmod= ; socket file mode (default )
chown=wwwad:wwwad ; socket file uid:gid owner
;username=user ; default is no username (open server)
;password= ; default is no password (open server) ;[inet_http_server] ; inet (TCP) server disabled by default
;port= ; ip_address:port specifier, *:port for all iface
;username=admin ; default is no username (open server)
;password=kongzg!@# ; default is no password (open server) [supervisord]
logfile=/data/supervisor/supervisord.log ; main log file; default $CWD/supervisord.log
logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
logfile_backups= ; # of main logfile backups; means none, default
loglevel=info ; log level; default info; others: debug,warn,trace
pidfile=/data/supervisor/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=false ; start in foreground if true; default false
minfds= ; min. avail startup file descriptors; default
minprocs= ; min. avail process descriptors;default
;umask= ; process file creation umask; default
user=wwwad ; default is current user, required if root
;identifier=supervisor ; supervisord identifier, default is 'supervisor'
;directory=/tmp ; default is not to cd during start
;nocleanup=true ; don't clean up tempfiles at start; default false
;childlogdir=/tmp ; 'AUTO' child log dir, default $TEMP
;environment=KEY="value" ; key value pairs to add to environment
;strip_ansi=false ; strip ansi escape codes in logs; def. false ; The rpcinterface:supervisor section must remain in the config file for
; RPC (supervisorctl/web interface) to work. Additional interfaces may be
; added by defining them in separate [rpcinterface:x] sections. [rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface ; The supervisorctl section configures how supervisorctl will connect to
; supervisord. configure it match the settings in either the unix_http_server
; or inet_http_server section. [supervisorctl]
serverurl=unix:///data/supervisor/supervisor.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris ; should be same as in [*_http_server] if set
;password= ; should be same as in [*_http_server] if set
;prompt=mysupervisor ; cmd line prompt (default "supervisor")
;history_file=~/.sc_history ; use readline history if available ; The sample program section below shows all possible program subsection values.
; Create one or more 'real' program: sections to be able to control them under
; supervisor. ;[program:theprogramname]
;command=/bin/cat ; the program (relative uses PATH, can take args)
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs= ; number of processes copies to start (def )
;directory=/tmp ; directory to cwd to before exec (def no cwd)
;umask= ; umask for process (default None)
;priority= ; the relative start priority (default )
;autostart=true ; start at supervisord start (default: true)
;startsecs= ; # of secs prog must stay up to be running (def. )
;startretries= ; max # of serial start failures when starting (default )
;autorestart=unexpected ; when to restart if exited after running (def: unexpected)
;exitcodes=, ; 'expected' exit codes used with autorestart (default ,)
;stopsignal=QUIT ; signal used to kill process (default TERM)
;stopwaitsecs= ; max num secs to wait b4 SIGKILL (default )
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
;user=chrism ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups= ; # of stdout logfile backups ( means none, default )
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
;stdout_events_enabled=false ; emit events on stdout writes (default false)
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stderr_logfile_backups= ; # of stderr logfile backups ( means none, default )
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
;stderr_events_enabled=false ; emit events on stderr writes (default false)
;environment=A="",B="" ; process environment additions (def no adds)
;serverurl=AUTO ; override serverurl computation (childutils) ; The sample eventlistener section below shows all possible eventlistener
; subsection values. Create one or more 'real' eventlistener: sections to be
; able to handle event notifications sent by supervisord. ;[eventlistener:theeventlistenername]
;command=/bin/eventlistener ; the program (relative uses PATH, can take args)
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs= ; number of processes copies to start (def )
;events=EVENT ; event notif. types to subscribe to (req'd)
;buffer_size= ; event buffer queue size (default )
;directory=/tmp ; directory to cwd to before exec (def no cwd)
;umask= ; umask for process (default None)
;priority=- ; the relative start priority (default -)
;autostart=true ; start at supervisord start (default: true)
;startsecs= ; # of secs prog must stay up to be running (def. )
;startretries= ; max # of serial start failures when starting (default )
;autorestart=unexpected ; autorestart if exited after running (def: unexpected)
;exitcodes=, ; 'expected' exit codes used with autorestart (default ,)
;stopsignal=QUIT ; signal used to kill process (default TERM)
;stopwaitsecs= ; max num secs to wait b4 SIGKILL (default )
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
;user=chrism ; setuid to this UNIX account to run the program
;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups= ; # of stdout logfile backups ( means none, default )
;stdout_events_enabled=false ; emit events on stdout writes (default false)
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stderr_logfile_backups= ; # of stderr logfile backups ( means none, default )
;stderr_events_enabled=false ; emit events on stderr writes (default false)
;environment=A="",B="" ; process environment additions
;serverurl=AUTO ; override serverurl computation (childutils) ; The sample group section below shows all possible group values. Create one
; or more 'real' group: sections to create "heterogeneous" process groups. ;[group:thegroupname]
;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions
;priority= ; the relative start priority (default ) ; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves. ;[include]
;files = relative/directory/*.ini [include]
files = /etc/supervisor/conf/*.conf
program 的配置文件
[program: test]
command=xxxxxxxx ;如果有多条命令,可以写入shell脚本再在这里调用
directory=xxxxx ;执行命令时切换到的目录
user=xxxx ;执行命令所用的linux用户身份
autorestart=true ;是否自动重启
autostart=true ;启动supervisor时是否自行启动该程序
redirect_stderr=true ;如果为true则将stderr发送到stdout相应的log文件中去
stdout_logfile=/path/to/logfile ;制定stdout的输出文件
stdout_logfile_maxbytes=10MB ;限定logfile的大小, 默认为50M
stdout_logfile_backups= ;保存logfile的最大数目,如果操作这个数目则对最早的logfile进行覆盖,默认为10
environment=A="", B="" ;设置环境变量,这里可以保存运行程序需要的参数 这里记住,我们每添加一次program的时候,我们需要更新新的配置到supervisord
supervisorctl update 这里的supervisorctl reload的功能是重启所有的程序 启动某一个程序
supervisorctl start programe_name 一、添加好配置文件后 二、更新新的配置到supervisord
supervisorctl update 三、重新启动配置中的所有程序
supervisorctl reload 四、启动某个进程(program_name=你配置中写的程序名称)
supervisorctl start program_name 五、查看正在守候的进程
supervisorctl status 六、停止某一进程 (program_name=你配置中写的程序名称)
spervisorctl stop program_name 七、重启某一进程 (program_name=你配置中写的程序名称)
supervisorctl restart program_name 八、停止全部进程
supervisorctl stop all 注意:显示用stop停止掉的进程,用reload或者update都不会自动重启。
supervisor 执行命令的额时候报一下错误
Error: .ini file does not include supervisorctl section
For help, use /usr/local/bin/supervisorctl -h 或者 error: <class 'socket.error'>, [Errno ] Network is unreachable: file: /usr/lib64/python2./socket.py line: 这个时候 切换到/etc/supervisor目录执行以上的命令
supervisor 安装脚本的更多相关文章
- supervisor安装和配置
直接命令 easy_install supervisor 如果报错先安装 yum install python-setuptools,再上面一条命令: 安装成功后显示finished,我们再次进行py ...
- Supervisor 安装及配置管理uwsgi进程
Supervisor介绍 Supervisor 允许其用户在UNIX类操作系统上控制多个进程. 块如下: 方便 需要为每个进程实例编写rc.d脚本通常是不方便的. rc.d脚本是进程初始化/自动启动/ ...
- Supervisor安装与配置(Linux/Unix进程管理工具)
原文链接:http://blog.csdn.net/xyang81/article/details/51555473 Supervisor(http://supervisord.org/)是用Pyth ...
- Linux系统下 Supervisor 安装搭建
在 web 应用部署到线上后,需要保证应用一直处于运行状态,在遇到程序异常.报错等情况,导致 web 应用终止时,需要保证程序可以立刻重启,继续提供服务. 所以,就需要一个工具,时刻监控 web 应用 ...
- Supervisor安装与配置
Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统 ...
- CentOS7下Supervisor安装与配置
Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统 ...
- mysql 自动备份和nginx自动安装脚本
一.自动备份Mysql脚本: 如下脚本为mysql自动备份脚本,仅供参考,可以根据实际情况修改. #!/bin/sh #auto backup mysql #wugk #Define PATH定义变量 ...
- Linux安装脚本需要交互之如何实现自动安装
Linux中shell脚本运行时经常需要进行交互,比如安装软件的过程中对license声明的确认,需要输入yes,回车之类的确认信息.这个在自动化安装的时候就会是个问题. 通常对于这个问题比较灵活的解 ...
- iredmail安装脚本分析(一)---iRedmail.sh
iredmail是一套以postfix为核心的整合邮件系统的安装脚本,可以达到快速部署邮件服务器的目的.为了让自己不遗忘shell的语法,所以闲来无事,学习一下他的代码. 我从官网下载他的最新版,解压 ...
随机推荐
- Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'系列二:reset slave
reset slave会清除从库的所有复制信息.一般应用场景:如切换为不同的Master, 主从重做等: 1. 命令在slave上执行,执行前一定要stop slave. 2. 执行reset sla ...
- JavaWeb开发之网站实现文件上传功能
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6073505.html 一个功能完善的JavaWeb应用,必不可少的一个功能就是文件的上传.无论是用户的 ...
- Java 共享数据读写(多线程)
public class StopThread { // 静态字段的读写不必须要同步才能生效,尽管读写是原子的(atom) private static boolean stopRequested; ...
- SpringBoot集成自定义HandlerMethodArgumentResolver
传统SpringMVC集成自定义HandlerMethodArgumentResolver的方式为:http://www.cnblogs.com/yangzhilong/p/6282218.html ...
- PHP5.4 需要添加的configure参数
./configure --prefix=/usr/local/php --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg --with-p ...
- Arduino和C51开发DS1302时钟
技术:51单片机.Arduino.DS1302时钟.串口通信 概述 本文实现51单片机和Arduino串口实时显示时钟功能,让读者对DS1302能够更好的理解,这次功能也和上节课学到的串口通信运用 ...
- 解决打开bootstrap模态框抖动问题
//打开模态框 function modalOpen(){ $('body').css("overflow", "hidden"); } //关闭模态框 fun ...
- 使用T-SQL语句操作视图
转自:使用T-SQL语句操作视图 提示:只能查看,删除,创建视图,不能对数据进行增,删,改操作. use StuManageDB go --判断视图是否存在 if exists(Select * fr ...
- libpcap详解【转】
libpcap详解 2010-12-01 22:07 libpcap(Packet Capture Library),即数据包捕获函数库,是Unix/Linux平台下的网络数据包捕获函数库.它是一个独 ...
- lsof命令详解(转)
lsof命令详解(转) 上一篇 / 下一篇 2011-06-09 21:56:41 / 个人分类:Linux 查看( 351 ) / 评论( 0 ) / 评分( 0 / 0 ) 在Linux中,ls ...