start-stop-daemon
start-stop-daemon是OpenRC计划的一部分,这个程序最先出现在Debian系的Linux发行版中,这里有个比较古老的手册页面,更详细更直观的办法当然是通过man start-stop-daemon来查看手册了。
start-stop-daemon最基本的两个功能就是--start和--stop,简写为-S和-K,然后再加上一个-s|--signal来给进程发送信号,功德圆满。
-x, --exec daemon,daemon就是真正要执行的进程脚本,比方说启动nginx,那么就是start-stop-daemon -x nginx-p, --pidfile pidfile,指定pid文件,至于pid文件的用途就多了,stop,status都少不了它。-n, --name,如果没有指定pid文件,那么就要通过指定name来停止进程了。-u, --user user[:group],指定脚本用哪个用户或用户组执行,init脚本是必须使用root权限来执行的,但是它fork出来的子进程我们一般会选择一个权限较低的用户。-b, --background,强制脚本在后台执行。-m, --make-pidfile,这个一般和-b配合,用于生成pid文件-d, --chdir path,切换进程的主目录,这个在构建守护进程的时候是很常用的。-r, --chroot path,在某些安全性要求较高的情况下,我们就需要用到chroot将进程工作环境与物理环境完全隔离开来。-1, --stdout logfile,将标准输出记录到log文件,与之相对应的就是-2, --stderr标准错误流。-w, --wait milliseconds,进程启动后,有这个参数会等待几毫秒来检测进程是否仍然存活。
-x daemon后面跟的执行脚本必须只能是一个文件名,有些程序运行时还需要指定一些参数,比如nginx -c file来指定nginx的配置文件,使用start-stop-daemon -x "nginx -c file"是会报错的,这些程序内的参数以另一种方式加载,start-stop-daemon -x daemon -- $ARGV,这里的双横线--后面跟的所有参数就会被带到程序中了,比如start-stop-daemon -x nginx -c /etc/nginx.conf
start-stop-daemon的更多相关文章
- init.d functions的daemon函数
daemon函数说明 # 该函数的作用是启动一个可执行的二进制程序: # 使用方法: # .daemon {--check program|--check=program} [--user usern ...
- teamviewer "TeamViewer Daemon is not running
执行下面的命令问题解决: # teamviewer --daemon enable enable Sat Jan :: CST Action: Installing daemon () for 'up ...
- linux系统编程之进程(八):守护进程详解及创建,daemon()使用
一,守护进程概述 Linux Daemon(守护进程)是运行在后台的一种特殊进程.它独立于控制终端并且周期性地执行某种任务或等待处理某些发生的事件.它不需要用户输入就能运行而且提供某种服务,不是对整个 ...
- CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
今天,在用icinga服务器端测试客户端脚本时,报如下错误: [root@mysql-server1 etc]# /usr/local/icinga/libexec/check_nrpe -H 192 ...
- ubuntu super daemon设置
super daemon是一个在Linux下面全面管理自己服务设置的东东,他可以接管很多服务的设定,只需要在/etc/xinetd.d/下面放置好自己的配置文件就可以了,那么,具体应该怎么配置呢? ...
- 【转】关于Java的Daemon线程的理解
原文地址:http://www.cnblogs.com/ChrisWang/archive/2009/11/28/1612815.html 关于Java的Daemon线程的理解 网上对Java的Dae ...
- linux下的守护进程daemon
什么是守护进程?其实感觉守护进程并没有什么明确的定义,只是守护进程有一些特征,这是它需要遵循的. 守护进程的第一个特征是长时间在后台运行的程序,并且主要是为了提供某种服务,而为了能够让服务尽可能随时都 ...
- java并发编程学习: 守护线程(Daemon Thread)
在正式理解这个概念前,先把 守护线程 与 守护进程 这二个极其相似的说法区分开,守护进程通常是为了防止某些应用因各种意外原因退出,而在后台独立运行的系统服务或应用程序. 比如:我们开发了一个邮件发送程 ...
- Another MySQL daemon already running with the same unix socket的解决
问题出现: 每周一需要备份一次数据库,即从服务器MySQL导出sql文件,再导入到我机器上虚拟机的MySQL里.但是今天早上连不上,我进入控制台用#service mysqld start强行启动,报 ...
- Android Studio: Failed to sync Gradle project 'xxx' Error:Unable to start the daemon process: could not reserve enough space for object heap.
创建项目的时候报错: Failed to sync Gradle project 'xxx' Error:Unable to start the daemon process: could not r ...
随机推荐
- C#中Math的使用总结
1.向上进位取整.Math.Ceiling 例如: Math.Ceiling(32.6)=33; Math.Ceiling(32.0)=32; 2.向下舍位取整.Math.Floor 例如: Math ...
- Install and Enable Telnet server in Ubuntu Linux
转:http://ubuntuguide.net/install-and-enable-telnet-server-in-ubuntu-linux 参考:http://auxnet.org/index ...
- oracle数据库维护常用操作
查看用户相关信息 查看数据库里面所有用户,前提是你是有dba权限的帐号,如sys,system select * from dba_users; 查看你能管理的所有用户! select * from ...
- 使用Vue-cli创建project遇到的坑
环境: win10 / node( v10.2.1) /npm( v5.6.0) 准备: 1.安装node:上node官网下载node版本进行安装 2.安装vue-cli:npm install -- ...
- RedisTemplate SerializationFailedException: Failed to deserialize payload 异常解决
问题描述: 使用RedisTemplate(spring-data-redis )进行redis操作的封装 , 现有一个incr的key , 当调用incr后返回值一切正常, 当对此key进行get调 ...
- Drupal 7.31 SQL Injection Exp
#-*- coding:utf-8 -*- import urllib2,sys import hashlib # Calculate a non-truncated Drupal 7 compa ...
- nagios系列教程地址
http://www.sosidc.com/sort/10/page/3 http://www.sosidc.com/sort/10/page/2 http://www.sosidc.com/sort ...
- javascript快速入门4--函数与内置对象
函数 函数(又称为方法)用于对一大段为了达到某种目的的代码进行归类,以使代码更具有条理: //一段计算三角形面积的代码 var wide=window.prompt("请输入三角形的底边长度 ...
- Mybatis学习记录(一)---- 简单的CRUD
1 mybatis是什么? mybatis是一个持久层的框架,是apache下的顶级项目. mybatis托管到googlecode下,再后来托管到github下(https://github.com ...
- django dispatch
from django.views import View # 这里Home需要继承View class Home(View): # 这样这里就相当于一个装饰器的功能,可以自己定制化内容 def di ...