分类
devops

daemon总结


Last Updated on 2022-11-09

daemon

daemon翻译为守护神,在unix中解释为守护进程,参考Why are daemons called daemons?

daemon程序是后台运行的,就是background,这和foreground相反的。

比如 nginx启动的传入如下参数,代表关闭后台运行,同时也就代表打开前台运行

/usr/sbin/nginx -g "daemon off;"

再比如 apache httpd 启动,代表前台运行模式

/usr/sbin/httpd -D FOREGROUND

/usr/bin/daemon

### debian
apt install daemon
### centos
### <https://www.libslack.org/daemon/INSTALL>

daemon function in /etc/init.d/functions

daemon在centos上可能是个函数

/etc/init.d/functions is a Red Hat developed script for SYSVR4 init on GNU/Linux.

比如报错

/etc/rc.d/init.d/jenkins: line 59: /etc/init.d/functions: No such file or directory
yum install -y initscripts

/sbin/start-stop-daemon

/sbin/start-stop-daemon在debian系统里是在dpkg包中。可以通过apt安装。

apt install dpkg

源代码https://git.dpkg.org/git/dpkg/dpkg.git

/sbin/start-stop-daemon在alpinelinux系统里是在openrc包中。

daemonize

daemonize Home Page: http://software.clapper.org/daemonize/

process manager

ref