X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=man%2Fdaemon.xml;h=ab58d08a76424b9bd9ea3b64016e215538479f12;hp=7790420c6eb7154cfa80625f24fdb9db43cb0e2b;hb=9003d9b0d628be059922e522fd35f9c5b4d8b039;hpb=409dee2e44e7dc73d6bf00d782938e4cb4105f5b diff --git a/man/daemon.xml b/man/daemon.xml index 7790420c6..ab58d08a7 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 stdin, stdout, + stderr (i.e. the first three file descriptors 0, 1, 2). This ensures that no accidentally passed file descriptor stays around in the daemon @@ -128,8 +128,8 @@ In the daemon process, connect /dev/null - to STDIN, STDOUT, - STDERR. + to standard input, output, and error. + In the daemon process, reset the umask to 0, so that the file @@ -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 @@ -223,15 +223,16 @@ service. Note that new-style init systems - guarantee execution of daemon processes in - a clean process context: it is guaranteed that + guarantee execution of daemon processes in a + clean process context: it is guaranteed that the environment block is sanitized, that the signal handlers and mask is reset and that no left-over file descriptors are passed. Daemons - will be executed in their own session, and - STDIN/STDOUT/STDERR connected to + will be executed in their own session, with + standard input/output/error connected to /dev/null unless - otherwise configured. The umask is reset. + otherwise configured. The umask is reset. + It is recommended for new-style daemons to implement the following: @@ -251,7 +252,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. @@ -324,7 +325,7 @@ Instead of using the syslog() call to log directly to the system syslog service, a new-style daemon may - choose to simply log to STDERR via + 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 @@ -394,7 +395,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 @@ -408,7 +409,7 @@ description files. In systemd, if the developer or - administrator wants to make sure a service or + administrator wants to make sure that a service or other unit is activated automatically on boot, it is recommended to place a symlink to the unit file in the .wants/ @@ -765,12 +766,19 @@ PKG_PROG_PKG_CONFIG AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), - [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) -if test "x$with_systemdsystemunitdir" != xno; then - AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) -fi -AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) + [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, + [with_systemdsystemunitdir=auto]) +AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ + def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) + + AS_IF([test "x$def_systemdsystemunitdir" = "x"], + [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], + [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) + with_systemdsystemunitdir=no], + [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) +AS_IF([test "x$with_systemdsystemunitdir" != "xno"], + [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) +AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) This snippet allows automatic installation of the unit files on systemd