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
- https://github.com/daleobrien/start-stop-daemon
- https://man7.org/linux/man-pages/man8/start-stop-daemon.8.html
- https://man7.org/linux/man-pages/man3/daemon.3.html
- https://linux.die.net/man/3/daemon
- https://www.libslack.org/daemon/
- https://manpages.debian.org/bullseye/dpkg/start-stop-daemon.8.en.html
- https://packages.debian.org/buster/dpkg
- https://git.dpkg.org/git/dpkg/dpkg.git/tree/utils/start-stop-daemon.c
- http://polarhome.com/service/man/?qf=start-stop-daemon&af=0&sf=0&of=Alpinelinux&tf=2
- https://aur.archlinux.org/packages/start-stop-daemon/
- https://wiki.gentoo.org/wiki/Runit