runsv(8) manual page http://smarden.org/runit/runsv.8.html

Name

runsv - starts and monitors a service and optionally an appendant log service

Synopsis

runsv service

Description

service must be a directory.

runsv switches to the directory service and starts ./run. If ./run exits and ./finish exists, runsv starts ./finish. If ./finish doesn’t exist or ./finish exits, runsv restarts ./run.

If ./run or ./finish exit immediately, runsv waits a second before starting ./finish or restarting ./run.

Two arguments are given to ./finish. The first one is ./run’s exit code, or -1 if ./run didn’t exit normally. The second one is the least significant byte of the exit status as determined by waitpid(2); for instance it is 0 if ./run exited normally, and the signal number if ./run was terminated by a signal. If runsv cannot start ./run for some reason, the exit code is 111 and the status is 0.

If the file service/down exists, runsv does not start ./run immediately. The control interface (see below) can be used to start the service and to give other commands to runsv.

If the directory service/log exists, runsv creates a pipe, redirects service/run’s and service/finish’s standard output to the pipe, switches to the directory service/log and starts ./run (and ./finish) exactly as described above for the service directory. The standard input of the log service is redirected to read from the pipe.

runsv maintains status information in a binary format (compatible to the daemontools’ supervise program) in service/supervise/status and service/log/supervise/status, and in a human-readable format inservice/supervise/stat, service/log/supervise/stat, service/supervise/pid, service/log/supervise/pid.

Control

The named pipes service/supervise/control, and (optionally) service/log/supervise/control are provided to give commands to runsv. You can use sv(8) to control the service or just write one of the following characters to the named pipe:

u
Up. If the service is not running, start it. If the service stops, restart it.
d
Down. If the service is running, send it a TERM signal, and then a CONT signal. If ./run exits, start ./finish if it exists. After it stops, do not restart service.
o
Once. If the service is not running, start it. Do not restart it if it stops.
p
Pause. If the service is running, send it a STOP signal.
c
Continue. If the service is running, send it a CONT signal.
h
Hangup. If the service is running, send it a HUP signal.
a
Alarm. If the service is running, send it a ALRM signal.
i
Interrupt. If the service is running, send it a INT signal.
q
Quit. If the service is running, send it a QUIT signal.
1
User-defined 1. If the service is running, send it a USR1 signal.
2
User-defined 2. If the service is running, send it a USR2 signal.
t
Terminate. If the service is running, send it a TERM signal.
k
Kill. If the service is running, send it a KILL signal.
x
Exit. If the service is running, send it a TERM signal, and then a CONT signal. Do not restart the service. If the service is down, and no log service exists, runsv exits. If the service is down and a log service exists, runsv closes the standard input of the log service, and waits for it to terminate. If the log service is down, runsv exits. This command is ignored if it is given to service/log/supervise/control.

Example: to send a TERM signal to the socklog-unix service, either do # sv term /service/socklog-unix
or
# printf t >/service/socklog-unix/supervise/control

printf(1) usually blocks if no runsv process is running in the service directory.

Customize Control

For each control character c sent to the control pipe, runsv first checks if service/control/c exists and is executable. If so, it starts service/control/c and waits for it to terminate, before interpreting the command. If the program exits with return code 0, runsv refrains from sending the service the corresponding signal. The command o is always considered as command u. On command d first service/control/t is checked, and thenservice/control/d. On command x first service/control/t is checked, and then service/control/x. The control of the optional log service cannot be customized.

Signals

If runsv receives a TERM signal, it acts as if the character x was written to the control pipe.

Exit Codes

runsv exits 111 on an error on startup or if another runsv is running in service.

runsv exits 0 if it was told to exit.

See Also

sv(8)chpst(8)svlogd(8)runit(8)runit-init(8)runsvdir(8)runsvchdir(8)utmpset(8)

http://smarden.org/runit/

Author

Gerrit Pape <pape@smarden.org>

runsv的更多相关文章

  1. gitlab svlogd runsv 基于Rotated Log的日志统计

    小结: 1. 日志轮询 log roate 日志文件自动转存和重命名 2. rotated log独立于其他模块,可以以静态库或者动态库的形式支持二次开发: 3. [root@d1 ~]# gitla ...

  2. ubuntu上runsv/runit小记

    一个偶然的原因,在研究git使用时,发现有个自动启动的git-daemon进程: wellbye@AY130622174524343529Z:~$ ps aux|grep git root ? Ss ...

  3. 解决GITLAB无法启动runsv no running

    可以先尝试用 systemctl start gitlab-runsvdir.service 如果冻结不动的话,就需要查看系统服务项了 systemctl -t target 如果系统正常的话,所有任 ...

  4. 给Android系统安装busybox

    转自:http://blog.csdn.net/lxgwm2008/article/details/38925051 busybox号称Linux平台的瑞士军刀,它集成了100多个最常用的Linux命 ...

  5. git-daemon的快捷搭建

    使用git-daemon进行git服务器搭建 1.安装git-daemon 前提是已经安装git sudo apt-get install git git-core 然后安装git-daemon su ...

  6. Gitlab环境快速部署(RPM包方式安装)

    之前梳理了一篇Gitlab的安装CI持续集成系统环境---部署Gitlab环境完整记录,但是这是bitnami一键安装的,版本比较老.下面介绍使用rpm包安装Gitlab,下载地址:https://m ...

  7. CentOS7下gitlab的搭建

    gitlab的搭建 安装基础包 yum -y install curl policycoreutils openssh-server openssh-clients 启动sshd systemctl ...

  8. nginx(二)----ubuntu14.04下启动或重启和关闭nginx

    /** * lihaibo * 文章内容都是根据自己工作情况实践得出. *如有错误,请指正 *转载请注明出处 */ 一.启动 /usr/local/nginx/sbin/nginx或者cd /usr/ ...

  9. Gitlab搭建安装及使用中遇到的问题。

    一.CentOS7安装gitlab-ce 1.下载及安装rpm软件包. 下载RPM包 curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ ...

随机推荐

  1. Web测试框架SeleniumBase

    前几天逛GitHub发现一个基于Selenium和unittest单元测试框架的一个测试框架SeleniumBase. Github地址:https://github.com/seleniumbase ...

  2. 构建更好的HashMap

    在7月份的那期 Java理论与实践(“并发集合类”)中,我们简单地回顾了可伸缩性的瓶颈,并讨论了怎么用共享数据结构的方法获得更高的并发性和吞吐量.有时候学习的最好方法是分析专家的成果,所以这个月我们将 ...

  3. luogu P2423 双塔

    题目描述 2001年9月11日,一场突发的灾难将纽约世界贸易中心大厦夷为平地,Mr. F曾亲眼目睹了这次灾难.为了纪念“911”事件,Mr. F决定自己用水晶来搭建一座双塔.Mr. F有N块水晶,每块 ...

  4. BZOJ 3672 NOI 2014 购票

    题面 Description 今年夏天,NOI在SZ市迎来了她30周岁的生日.来自全国 n 个城市的OIer们都会从各地出发,到SZ市参加这次盛会. 全国的城市构成了一棵以SZ市为根的有根树,每个城市 ...

  5. 键盘弹出后上提view隐藏后下拉view还原并修改scroll过程中旋转屏幕到竖屏view显示错误

    1,注册键盘相应事件 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillSho ...

  6. linux 学习解决归档管理器打开rar和zip中文文件名乱码问题

    在ubunut下打开windows下压缩的rar文件和zip压缩文件出现中文文件名乱码的问题真的很头疼.文件名乱码其实也没有什么关系是不?至少重命名再改回来或者是使用英文命名都可以克服.不巧的是,如此 ...

  7. MATLAB基础操作符与数据格式显示

    1.冒号":" 基本使用如下: X=1:10:表示生成向量[1,2,3,4,5,6,7,8,9,10] X=J:i:k ;表示向量[j,j+i,j+2i,...,k]; A(:,j ...

  8. H5 性能调优 工具

    1.阿里测:http://www.alibench.com 2.奇云测:http://ce.cloud.360.cn 3.百度应用性能检测中心:http://apm.baidu.com 推荐理由:这3 ...

  9. EVB-P6UL:一识庐山真面目

    前言 原创文章,转载引用务必注明链接.水平有限,如有疏漏,欢迎指正. 本文使用Markdown写成,为获得更好的阅读体验与正确的图片链接显示,请访问我的博客原文: 在爱板网上看到这个活动,昨晚确认,今 ...

  10. vue2.X 自定义 模态框 modal

    1.自定义 modal Modal.vue <!-- 模态框 --> <template> <div class="modal-mask" v-sho ...