X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=man%2Fdaemon.xml;h=d7cf0023634c8df943c1382b1c84ac784dc93b77;hb=6fc27667950fe153033f0f49cb5b57e8954c3e54;hp=88dd082a33e356d2a3ece0deedc0aaa406ff109e;hpb=fc9acf252ffd0992a6bb0870f76c8d87cead2088;p=elogind.git diff --git a/man/daemon.xml b/man/daemon.xml index 88dd082a3..d7cf00236 100644 --- a/man/daemon.xml +++ b/man/daemon.xml @@ -74,8 +74,8 @@ Close all open file - descriptors except stdin, stdout, - stderr (i.e. the first three file + descriptors except standard input, output, + and error (i.e. the first three file descriptors 0, 1, 2). This ensures that no accidentally passed file descriptor stays around in the daemon @@ -149,7 +149,7 @@ write the daemon PID (as returned by getpid()) to a PID file, for example - /var/run/foobar.pid + /run/foobar.pid (for a hypothetical daemon "foobar") to ensure that the daemon cannot be started more than once. This must be @@ -158,9 +158,7 @@ it is verified at the same time that the PID previously stored in the PID file no longer exists or belongs to a - foreign process. Commonly, some kind of - file locking is employed to implement - this logic. + foreign process. In the daemon process, drop privileges, if possible and @@ -252,7 +250,7 @@ detect service errors and problems. It is recommended to follow the exit code scheme as defined in the LSB + url="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB recommendations for SysV init scripts. @@ -323,29 +321,21 @@ interface. Instead of using the - syslog() call to log directly to the - system syslog service, a new-style daemon may - choose to simply log to standard error via - fprintf(), which is then forwarded to - syslog by the init system. If log - priorities are necessary, these can be - encoded by prefixing individual log - lines with strings like "<4>" - (for log priority 4 "WARNING" in the - syslog priority scheme), following a - similar style as the Linux kernel's - printk() priority system. In fact, - using this style of logging also - enables the init system to optionally - direct all application logging to the - kernel log buffer (kmsg), as - accessible via - dmesg1. This - kind of logging may be enabled by - setting - StandardError=syslog - in the service unit file. For details, - see + syslog() call to + log directly to the system syslog + service, a new-style daemon may choose + to simply log to standard error via + fprintf(), which + is then forwarded to syslog by the + init system. If log priorities are + necessary, these can be encoded by + prefixing individual log lines with + strings like "<4>" (for log + priority 4 "WARNING" in the syslog + priority scheme), following a similar + style as the Linux kernel's + printk() priority + system. For details, see sd-daemon3 and systemd.exec5. @@ -354,7 +344,7 @@ These recommendations are similar but not identical to the Apple + url="https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html">Apple MacOS X Daemon Requirements. @@ -395,7 +385,7 @@ exclusively on boot (and manually by the administrator) via SysV init scripts, as detailed in the LSB + url="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB Linux Standard Base Core Specification. This method of activation is supported ubiquitously on Linux @@ -942,6 +932,14 @@ fi + + Placing Daemon Data + + It is recommended to follow the genreal + guidelines for placing package files, as discussed in + file-hierarchy7. + + See Also @@ -950,7 +948,8 @@ fi sd_listen_fds3, sd_notify3, daemon3, - systemd.service5 + systemd.service5, + file-hierarchy7