supervisord多实例运行

服务器上已经运行了一个supervisord的服务 不过是在root权限下 在线上是没有权限的,自己想是否可以自己运行一个实例呢 研究后发现是可以
查看:

$ supervisord -h
supervisord -- run a set of applications as daemons.

Usage: /bin/supervisord [options]

Options:
-c/--configuration FILENAME -- configuration file
-n/--nodaemon -- run in the foreground (same as 'nodaemon true' in config file)
-h/--help -- print this usage message and exit
-v/--version -- print supervisord version number and exit
-u/--user USER -- run supervisord as this user (or numeric uid)
-m/--umask UMASK -- use this umask for daemon subprocess (default is 022)
-d/--directory DIRECTORY -- directory to chdir to when daemonized
-l/--logfile FILENAME -- use FILENAME as logfile path
-y/--logfile_maxbytes BYTES -- use BYTES to limit the max size of logfile
-z/--logfile_backups NUM -- number of backups to keep when max bytes reached
-e/--loglevel LEVEL -- use LEVEL as log level (debug,info,warn,error,critical)
-j/--pidfile FILENAME -- write a pid file for the daemon process to FILENAME
-i/--identifier STR -- identifier used for this instance of supervisord
-q/--childlogdir DIRECTORY -- the log directory for child process logs
-k/--nocleanup --  prevent the process from performing cleanup (removal of
                   old automatic child log files) at startup.
-a/--minfds NUM -- the minimum number of file descriptors for start success
-t/--strip_ansi -- strip ansi escape codes from process output
--minprocs NUM  -- the minimum number of processes available for start success
--profile_options OPTIONS -- run supervisord under profiler and output
                             results based on OPTIONS, which  is a comma-sep'd
                             list of 'cumulative', 'calls', and/or 'callers',
                             e.g. 'cumulative,callers')

发现增加一个-k参数 修改配置的pid什么就行了
配置文件如下:

#supervisord进程处理

#日志目录创建
SUPERVISOR_LOG_DIR=/data/logs/supervisor
if [ ! -d "${SUPERVISOR_LOG_DIR}" ]; then
    CMD=$CMD"mkdir -p ${SUPERVISOR_LOG_DIR};"
fi

#进程停止
SUPERVISORPIDFILE=${SUPERVISOR_LOG_DIR}/supervisord.pid
if [ -f ${SUPERVISORPIDFILE} ]; then
    PID=$(cat $SUPERVISORPIDFILE)
    CMD=$CMD"kill -15 ${PID};"
fi

#重启进程
SUPERVISOR_CONF_FILE="${ROOT}/supervisor.d/${DEPLOY_ENV}/supervisord.conf"
CMD=$CMD"supervisord -k -c ${SUPERVISOR_CONF_FILE};"

效果图:
这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值