{
    "content": [
        {
            "type": "text",
            "text": "# daemon (man)\n\n## NAME\n\ndaemon - turns other processes into daemons\n\n## SYNOPSIS\n\nusage: daemon [options] [--] [cmd arg...]\noptions:\n-h, --help                - Print a help message then exit\n-V, --version             - Print a version message then exit\n-v, --verbose[=level]     - Set the verbosity level\n-d, --debug[=level]       - Set the debugging level\n-C, --config=path         - Specify the system configuration file\n-N, --noconfig            - Bypass the system configuration file\n-n, --name=name           - Guarantee a single named instance\n-X, --command=\"cmd\"       - Specify the client command as an option\n-P, --pidfiles=/dir       - Override standard pidfile location\n-F, --pidfile=/path       - Override standard pidfile name and location\n-u, --user=user[:[group]] - Run the client as user[:group]\n-R, --chroot=path         - Run the client with path as root\n-D, --chdir=path          - Run the client in directory path\n-m, --umask=umask         - Run the client with the given umask\n-e, --env=\"var=val\"       - Set a client environment variable\n-i, --inherit             - Inherit environment variables\n-U, --unsafe              - Allow execution of unsafe executable\n-S, --safe                - Disallow execution of unsafe executable\n-c, --core                - Allow core file generation\n--nocore              - Disallow core file generation (default)\n-r, --respawn             - Respawn the client when it terminates\n-a, --acceptable=#        - Minimum acceptable client duration (seconds)\n-A, --attempts=#          - Respawn # times on error before delay\n-L, --delay=#             - Delay between respawn attempt bursts (seconds)\n-M, --limit=#             - Maximum number of respawn attempt bursts\n--idiot               - Idiot mode (trust root with the above)\n-f, --foreground          - Run the client in the foreground\n-p, --pty[=noecho]        - Allocate a pseudo terminal for the client\n-B, --bind                - Stop when the user's last logind session ends\n-l, --errlog=spec         - Send daemon's error output to syslog or file\n-b, --dbglog=spec         - Send daemon's debug output to syslog or file\n-o, --output=spec         - Send client's output to syslog or file\n-O, --stdout=spec         - Send client's stdout to syslog or file\n-E, --stderr=spec         - Send client's stderr to syslog or file\n--ignore-eof          - After SIGCHLD ignore any client output\n--read-eof            - After SIGCHLD read any client output (default)\n--running             - Check if a named daemon is running\n--restart             - Restart a named daemon client\n--stop                - Terminate a named daemon process\n--signal=signame      - Send a signal to a named daemon\n--list                - Print a list of named daemons\n\n## DESCRIPTION\n\ndaemon(1) turns other processes into daemons. There are many tasks that need to be performed\nto correctly set up a daemon process. This can be tedious. daemon performs these tasks for\nother processes.\n\n## TLDR\n\n> Turns other processes into daemons.\n\n- Run a command as a daemon:\n  `daemon {{-n|--name}} \"{{name}}\" {{command}}`\n- Run a command as a daemon which will restart if the command crashes:\n  `daemon {{-n|--name}} \"{{name}}\" {{-r|--respawn}} {{command}}`\n- Run a command as a daemon which will restart if it crashes, with two attempts every 10 seconds:\n  `daemon {{-n|--name}} \"{{name}}\" {{-r|--respawn}} {{-A|--attempts}} 2 {{-L|--delay}} 10 {{command}}`\n- Run a command as a daemon, writing logs to a specific file:\n  `daemon {{-n|--name}} \"{{name}}\" {{-l|--errlog}} {{path/to/file.log}} {{command}}`\n- Kill a daemon (SIGTERM):\n  `daemon {{-n|--name}} \"{{name}}\" --stop`\n- List daemons:\n  `daemon --list`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (18 subsections)\n- **EXPANSION**\n- **FILES**\n- **MESSAGING**\n- **CAVEAT**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "daemon",
        "section": "",
        "mode": "man",
        "summary": "daemon - turns other processes into daemons",
        "synopsis": "usage: daemon [options] [--] [cmd arg...]\noptions:\n-h, --help                - Print a help message then exit\n-V, --version             - Print a version message then exit\n-v, --verbose[=level]     - Set the verbosity level\n-d, --debug[=level]       - Set the debugging level\n-C, --config=path         - Specify the system configuration file\n-N, --noconfig            - Bypass the system configuration file\n-n, --name=name           - Guarantee a single named instance\n-X, --command=\"cmd\"       - Specify the client command as an option\n-P, --pidfiles=/dir       - Override standard pidfile location\n-F, --pidfile=/path       - Override standard pidfile name and location\n-u, --user=user[:[group]] - Run the client as user[:group]\n-R, --chroot=path         - Run the client with path as root\n-D, --chdir=path          - Run the client in directory path\n-m, --umask=umask         - Run the client with the given umask\n-e, --env=\"var=val\"       - Set a client environment variable\n-i, --inherit             - Inherit environment variables\n-U, --unsafe              - Allow execution of unsafe executable\n-S, --safe                - Disallow execution of unsafe executable\n-c, --core                - Allow core file generation\n--nocore              - Disallow core file generation (default)\n-r, --respawn             - Respawn the client when it terminates\n-a, --acceptable=#        - Minimum acceptable client duration (seconds)\n-A, --attempts=#          - Respawn # times on error before delay\n-L, --delay=#             - Delay between respawn attempt bursts (seconds)\n-M, --limit=#             - Maximum number of respawn attempt bursts\n--idiot               - Idiot mode (trust root with the above)\n-f, --foreground          - Run the client in the foreground\n-p, --pty[=noecho]        - Allocate a pseudo terminal for the client\n-B, --bind                - Stop when the user's last logind session ends\n-l, --errlog=spec         - Send daemon's error output to syslog or file\n-b, --dbglog=spec         - Send daemon's debug output to syslog or file\n-o, --output=spec         - Send client's output to syslog or file\n-O, --stdout=spec         - Send client's stdout to syslog or file\n-E, --stderr=spec         - Send client's stderr to syslog or file\n--ignore-eof          - After SIGCHLD ignore any client output\n--read-eof            - After SIGCHLD read any client output (default)\n--running             - Check if a named daemon is running\n--restart             - Restart a named daemon client\n--stop                - Terminate a named daemon process\n--signal=signame      - Send a signal to a named daemon\n--list                - Print a list of named daemons",
        "tldr_summary": "Turns other processes into daemons.",
        "tldr_examples": [
            {
                "description": "Run a command as a daemon",
                "command": "daemon {{-n|--name}} \"{{name}}\" {{command}}"
            },
            {
                "description": "Run a command as a daemon which will restart if the command crashes",
                "command": "daemon {{-n|--name}} \"{{name}}\" {{-r|--respawn}} {{command}}"
            },
            {
                "description": "Run a command as a daemon which will restart if it crashes, with two attempts every 10 seconds",
                "command": "daemon {{-n|--name}} \"{{name}}\" {{-r|--respawn}} {{-A|--attempts}} 2 {{-L|--delay}} 10 {{command}}"
            },
            {
                "description": "Run a command as a daemon, writing logs to a specific file",
                "command": "daemon {{-n|--name}} \"{{name}}\" {{-l|--errlog}} {{path/to/file.log}} {{command}}"
            },
            {
                "description": "Kill a daemon (SIGTERM)",
                "command": "daemon {{-n|--name}} \"{{name}}\" --stop"
            },
            {
                "description": "List daemons",
                "command": "daemon --list"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Display a help message and exit."
            },
            {
                "flag": "-V",
                "long": "--version",
                "arg": null,
                "description": "Display a version message and exit. -v[level], --verbose[=level] Set the message verbosity level to level (or 1 if level is not supplied). This only effects the --running and --list options. -d[level], --debug[=level] Set the debug message level to level (or 1 if level is not supplied). Level 1 traces high-level function calls. Level 2 traces lower-level function calls and shows configuration information. Level 3 adds environment variables. Level 9 adds every return value from select(2). Debug messages are sent to the destination specified by the --dbglog option (by default, the syslog(3) facility, daemon.debug). -C path, --config=path Specify the system configuration file to use. By default, /etc/daemon.conf is the system configuration file, if it exists and is not group- or world-writable, and does not exist in a group- or world-writable directory. The configuration file lets you predefine options that apply to all clients, and to specifically named clients. As well as the system configuration file, additional configuration files will be read from the directory whose path matches the system configuration file with \".d\" appended to it (e.g. /etc/daemon.conf.d). Any file in that directory whose name starts with a dot character (\".\") is ignored. The same checks as described above apply to these files as well. On BSD systems (except macOS), the system configuration file(s) are /usr/local/etc/daemon.conf and /usr/local/etc/daemon.conf.d/* by default. On macOS, when installed via macports, the system configuration file(s) are /opt/local/etc/daemon.conf and /opt/local/etc/daemon.conf.d/*."
            },
            {
                "flag": "-N",
                "long": "--noconfig",
                "arg": null,
                "description": "Bypass the system configuration files, /etc/daemon.conf and /etc/daemon.conf.d/*. Only the user's ~/.daemonrc and ~/.daemonrc.d/* configuration files will be read (if they exist). -n name, --name=name Create and lock a pidfile (name.pid), ensuring that only one daemon with the given name is active at the same time. The standard location of the pidfile is /var/run for root (/etc on Solaris, /opt/local/var/run on macOS when installed via macports), and /tmp for normal users. This location can be overridden with the --pidfiles option. The name may only consist of the following characters: -.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 While a named daemon's client process is running, there will also be a separate pidfile to record the process id of the client process. Its filename will be the same as the daemon pidfile's, except that the filename extension will be .clientpid rather than .pid. The only reason that there should be a .pid file, with no .clientpid file, is during the delay between respawn attempts bursts. -X \"cmd\", --command=\"cmd\" Specify the client command as an option. If a command is specified along with its name in the configuration file, then a daemon can be invoked merely by mentioning its name: daemon --name ftumch Note: If the client command is specified with the --command option, either in the configuration file, or on the command line, then any additional command line arguments on the daemon command line are appended to the client command that is specified with the --command option. -P /dir, --pidfiles=/dir Override the standard pidfile location. The standard pidfile location is /var/run for root (/etc on Solaris, /opt/local/var/run on macOS when installed via macports), and /tmp for normal users. This option only affects the --name and --list options. Use this option if these standard locations are unacceptable, but make sure that you don't forget where you put your pidfiles. This option is best used in configuration files, or in shell scripts, rather than on an interactive command line. The pidfile location will be created automatically only if it is within the user's home directory. -F /path, --pidfile=/path Override the standard pidfile name and location. The standard pidfile location is described immediately above. The standard pidfile name is the argument of the --name option followed by .pid. Use this option if the standard pidfile name and location are unacceptable, but make sure that you don't forget where you put your pidfile. This option is best used in configuration files, or in shell scripts, rather than on an interactive command line. The pidfile location will be created automatically only if it is within the user's home directory. -u user[:[group]], --user=user[:[group]] Run the client as a different user (and group). This only works for root. If the argument includes a :group specifier, daemon will assume the specified group and no other. Otherwise, daemon will assume all groups that the specified user is in. For backwards compatibility, \".\" may be used instead of \":\" to separate the user and group but since \".\" can appear in user and group names, ambiguities can arise such as using --user=u.g when users u and u.g and group g all exist. With such an ambiguity, daemon will assume the user u and group g. Use --user=u.g: instead for the other interpretation. -R path, --chroot=path Change the root directory to path before running the client. On some systems, only root can do this. Note that the path to the client program and to the configuration file (if any) must be relative to the new root path. -D path, --chdir=path Change the current directory to path before running the client. The default current directory is the root directory (possibly after chroot). -m umask, --umask=umask Change the umask to umask before running the client. umask must be a valid octal mode. The default umask is 022. -e \"var=val\", --env=\"var=val\" Set an environment variable for the client process. This option can be used any number of times. If it is used, only the supplied environment variables are passed to the client process. Otherwise, the client process inherits the current set of environment variables."
            },
            {
                "flag": "-i",
                "long": "--inherit",
                "arg": null,
                "description": "Explicitly inherit environment variables. This is only needed when the --env option is used. When this option is used, the --env option adds to the inherited environment, rather than replacing it."
            },
            {
                "flag": "-U",
                "long": "--unsafe",
                "arg": null,
                "description": "Allow reading an unsafe configuration file, and allow the execution of an unsafe executable. A configuration file or executable is considered to be unsafe if it is group- or world-writable or is in a directory that is group- or world-writable (following symbolic links). If an executable is a script that is interpreted by another executable, then it is considered to be unsafe if the interpreter is unsafe. If the interpreter is /usr/bin/env (with an argument that is a command name to be searched for in $PATH), then that command must be safe. By default, daemon(1) will refuse to read an unsafe configuration file or to execute an unsafe executable when run by root. This option overrides that behaviour and hence should never be used."
            },
            {
                "flag": "-S",
                "long": "--safe",
                "arg": null,
                "description": "Disallow reading an unsafe configuration file, and disallow the execution of an unsafe executable. By default, daemon(1) will allow reading an unsafe configuration file, and allow the execution of an unsafe executable, when run by normal users. This option overrides that behaviour."
            },
            {
                "flag": "-c",
                "long": "--core",
                "arg": null,
                "description": "Allow the client to create a core file. This should only be used for debugging, as it could lead to security-related information disclosures by daemons run by root."
            },
            {
                "flag": "",
                "long": "--nocore",
                "arg": null,
                "description": "By default, clients are prevented from creating a core file. If the --core option has been used in a configuration file to apply to all named daemons, then this option can be used to restore the default behaviour for specific named daemons."
            },
            {
                "flag": "-r",
                "long": "--respawn",
                "arg": null,
                "description": "Respawn the client when it terminates. Without this option, the termination of a client process causes daemon itself to terminate as well. -a #, --acceptable=# Specify the minimum acceptable duration of a client process, in seconds. This option can only be used with the --respawn option. If a client process terminates before this threshold is reached, then it is considered to have failed. The default value is 300 seconds. It cannot be set to less than 10 seconds, except by root when used in conjunction with the --idiot option. -A #, --attempts=# Specify the number of attempts to respawn before delaying. This option can only be used with the --respawn option. The default value is 5. It cannot be set to more than 100 attempts, except by root when used in conjunction with the --idiot option. -L #, --delay=# Specify the delay in seconds between each burst of respawn attempts. This option can only be used with the --respawn option. The default value is 300 seconds. It cannot be set to less than 10 seconds except by root when used in conjunction with the --idiot option. -M #, --limit=# Specify a limit to the number of respawn attempt bursts. This option can only be used with the --respawn option. The default value is 0, which means no limit."
            },
            {
                "flag": "",
                "long": "--idiot",
                "arg": null,
                "description": "Turn on idiot mode in which daemon will not enforce the minimum or maximum values normally imposed on the --acceptable, --attempts and --delay options. The --idiot option must appear before any of these options. Only the root user may use this option, because it can turn a slight misconfiguration into a lot of wasted CPU energy and log messages, somewhat akin to a self-inflicted denial of service. Idiot mode also allows the root user to expand environment variable notation (e.g. $VAR and ${VAR}) in command line option arguments, and in configuration files. By default, internal environment variable expansion is only performed for normal users. Note that this doesn't apply to any such expansion performed earlier by the shell that invokes daemon(1). See the EXPANSION section below for more details."
            },
            {
                "flag": "-f",
                "long": "--foreground",
                "arg": null,
                "description": "Run the client in the foreground. The client is not turned into a daemon. -p[noecho], --pty[=noecho] Connect the client to a pseudo terminal. This option can only be used with the --foreground option. This is the default when the --foreground option is supplied and daemon's standard input is connected to a terminal. This option is only necessary when the client process must be connected to a controlling terminal, but daemon itself has been run without a controlling terminal (e.g. from cron(8) or a pipeline). If the noecho argument is supplied with this option, the client's side of the pseudo terminal will be set to noecho mode. Use this only if there really is a terminal involved and input is being echoed twice."
            },
            {
                "flag": "-B",
                "long": "--bind",
                "arg": null,
                "description": "Automatically terminate the client process (and daemon(1) itself) as soon as the user has no systemd-logind(8) (or elogind(8)) user sessions. In other words, automatically terminate when the user logs out. If the user has no sessions to start with, the client process will be terminated immediately. This option is only available on Linux systems that have either systemd(1) (e.g. Debian) or elogind(8) (e.g. Slackware). On systems with systemd(1), you could instead use a systemd user service, particularly if your user account is not allowed to have user services that linger. -l spec, --errlog=spec Send daemon's standard output and standard error to the syslog destination or file that is specified by spec. If spec is a syslog destination of the form \"facility.priority\", then output is sent to syslog(3). Otherwise, output is appended to the file whose path is given in spec. By default, output is sent to the syslog destination, daemon.err. See the MESSAGING section below for more details. -b spec, --dbglog=spec Send daemon's debug output to the syslog destination or file that is specified by spec. If spec is a syslog destination of the form \"facility.priority\", then output is sent to syslog(3). Otherwise, output is appended to the file whose path is given in spec. By default, output is sent to the syslog destination daemon.debug. See the MESSAGING section below for more details. -o spec, --output=spec Capture the client's standard output and standard error, and send it to the syslog destination or file that is specified by spec. If spec is a syslog destination of the form \"facility.priority\", then output is sent to syslog(3). Otherwise, output is appended to the file whose path is given in spec. By default, output is discarded unless the --foreground option is present, in which case, the client's stdout and stderr are propagated to daemon's stdout and stderr, respectively. See the MESSAGING section below for more details. -O spec, --stdout=spec Capture the client's standard output, and send it to the syslog destination or file that is specified by spec. If spec is a syslog destination of the form \"facility.priority\", then output is sent to syslog(3). Otherwise, stdout is appended to the file whose path is given in spec. By default, stdout is discarded unless the --foreground option is present, in which case, the client's stdout is propagated to daemon's stdout. See the MESSAGING section below for more details. -E spec, --stderr=spec Capture the client's standard error, and send it to the syslog destination or file that is specified by spec. If spec is a syslog destination of the form \"facility.priority\", then stderr is sent to syslog(3). Otherwise, stderr is appended to the file whose path is given in spec. By default, stderr is discarded unless the --foreground option is present, in which case, the client's stderr is propagated to daemon's stderr. See the MESSAGING section below for more details."
            },
            {
                "flag": "",
                "long": "--ignore-eof",
                "arg": null,
                "description": "After receiving a SIGCHLD signal due to a stopped or restarted client process, don't bother reading the client's output until the end-of-file is reached before reaping the client process's termination status with wait(2). Normally, there will be little or no output after the SIGCHLD signal, because the client process has just terminated. However, the client process might have its own child processes keeping its output open long after its own termination. When this happens, by default, the client process remains as a zombie process until its child processes terminate and close the output. Waiting for the client's child processes to terminate before considering the client stopped, and before restarting a new invocation, might be desirable. If not, this option can be used to consider the client process as being terminated as soon as the SIGCHLD signal has been received, and reaping its termination status with wait(2) immediately."
            },
            {
                "flag": "",
                "long": "--read-eof",
                "arg": null,
                "description": "After receiving a SIGCHLD signal due to a stopped or restarted client process, continue reading the client's output until the end-of-file is reached before reaping the client process's termination status with wait(2). This is the default behaviour. Normally, there will be little or no output after the SIGCHLD signal, because the client process has just terminated. However, the client process might have its own child processes keeping its output open long after its own termination. When this happens, the client process remains as a zombie process until its child processes terminate and close the output. Waiting for the client's child processes to terminate before considering the client stopped, and before restarting a new invocation, might be desirable. If so, but the --ignore-eof option has been used in a configuration file to apply to all named daemons, then this option can be used to restore the default behaviour for specific named daemons."
            },
            {
                "flag": "",
                "long": "--running",
                "arg": null,
                "description": "Check whether or not a named daemon is running, then exit(3) with EXITSUCCESS if the named daemon is running or EXITFAILURE if it isn't. If the --verbose option is supplied, print a message before exiting. If both the named daemon and its client process are running, the output will look like this, showing both process IDs: daemon: name is running (pid 7455) (clientpid 7457) If the named daemon is running but its client process is not (there might be a delay between respawn attempt bursts), the output will look like this, showing only the daemon process's ID: daemon: name is running (pid 7455) (client is not running) If the named daemon is not running at all, the output will look like this: daemon: name is not running This option can only be used with the --name option. Note that the --chroot, --user, --name, --pidfiles and --pidfile (and possibly --config) options must be the same as for the target daemon."
            },
            {
                "flag": "",
                "long": "--restart",
                "arg": null,
                "description": "Instruct a named daemon to terminate and restart its client process, by sending it a SIGUSR1 signal. This will cause the named daemon to send its client process a SIGTERM signal to stop it. If the named daemon had been started with the --restart option, the named daemon will then restart its client process. Otherwise, this has the same effect as the --stop option, and the named daemon's client process is not restarted. This option can only be used with the --name option. Note that the --chroot, --user, --name, --pidfiles and --pidfile (and possibly --config) options must be the same as for the target daemon."
            },
            {
                "flag": "",
                "long": "--stop",
                "arg": null,
                "description": "Stop a named daemon by sending it a SIGTERM signal. This will cause the named daemon to send its client process a SIGTERM option and then exit. This option can only be used with the --name option. Note that the --chroot, --user, --name, --pidfiles and --pidfile (and possibly --config) options must be the same as for the target daemon. --signal=signame Send the given signal to a named daemon's client process. The signal can be specified either by number or by name (with or without the \"sig\" prefix). Any signal may be sent. However, the named daemon's client process might be ignoring some signals. For example, SIGHUP will be ignored by default unless the client process has installed a signal handler for it. The known list of signals are: hup, int, quit, ill, trap, abrt, iot, bus, fpe, kill, usr1, segv, usr2, pipe, alrm, term, stkflt, cld, chld, cont, stop, tstp, ttin, ttou, urg, xcpu, xfsz, vtalrm, prof, winch, poll, io, pwr, sys, emt and info. Not all of them are available on all platforms."
            },
            {
                "flag": "",
                "long": "--list",
                "arg": null,
                "description": "Print a list of the currently running named daemons whose pidfiles are in the applicable pidfile directory which will either be the default (i.e. /var/run for root (/etc on Solaris, /opt/local/var/run on macOS when installed via macports), and /tmp for normal users), or it will be specified by the --pidfiles option. Then exit. Without the --verbose option, this will only list the names of daemons whose pidfiles are locked, as this implies that the corresponding daemon must still be running. Note that pidfiles for daemons that were not started by daemon(1) might not be locked. An unlocked pidfile might indicate that daemon(1) has died unexpectedly, or it might just be a pidfile for a daemon that was not started by daemon(1). If this might lead to confusion, you might want to consider using a dedicated pidfiles directory for named daemons started by daemon(1), and leave the default pidfiles directories for other daemons that were started independently of daemon(1). With the --verbose option, the items in the list will look like the output of the --running option with --verbose, but with more detail. If there are no pidfiles at all, the output will look like this: No named daemons are running If a pidfile is locked, and there is a corresponding client pidfile, that indicates that the named daemon and its client are both running, and the output will look like this, showing both process IDs: name is running (pid ####) (client pid ####) If a pidfile is locked, but there is no client pidfile, that indicates that the named daemon is running, but its client is not (e.g. during a delay between respawn attempt bursts when the client is failing to start successfully), and the output will look like one of the following three options: When we can tell that the pidfile is for a process whose executable name is daemon: name is running (pid ####) (client is not running) When we can tell that the pidfile is for a process whose executable name is something other than daemon (i.e. is independent of daemon(1)): name is running (pid ####) (independent) When it's not possible to determine the name of the executable associated with the pidfile (i.e. On systems other than Linux without a /proc file system): name is running (pid ####) (client is not running or is independent) If a pidfile is not locked, and the applicable pidfiles directory is the default, that indicates either that the daemon has unexpectedly terminated, or just that the pidfile is for a daemon that was not started by daemon(1), and the output will look like this: name is not running (or is independent) If a pidfile is not locked, and the applicable pidfiles directory is not the default, then it is assumed that all pidfiles are for daemons that were started by daemon(1), and the output will look like this: name is not running As with all other programs, a -- argument signifies the end of options. Any options that appear on the command line after -- are part of the client command."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "libslack",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/libslack/3/json"
            },
            {
                "name": "coproc",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/coproc/3/json"
            },
            {
                "name": "pseudo",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/pseudo/3/json"
            },
            {
                "name": "init",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/init/8/json"
            },
            {
                "name": "inetd",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/inetd/8/json"
            },
            {
                "name": "fork",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/fork/2/json"
            },
            {
                "name": "umask",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/umask/2/json"
            },
            {
                "name": "setsid",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/setsid/2/json"
            },
            {
                "name": "chdir",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/chdir/2/json"
            },
            {
                "name": "chroot",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/chroot/2/json"
            },
            {
                "name": "setrlimit",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/setrlimit/2/json"
            },
            {
                "name": "setgid",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/setgid/2/json"
            },
            {
                "name": "setuid",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/setuid/2/json"
            },
            {
                "name": "setgroups",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/setgroups/2/json"
            },
            {
                "name": "initgroups",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/initgroups/3/json"
            },
            {
                "name": "syslog",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/syslog/3/json"
            },
            {
                "name": "kill",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/kill/2/json"
            },
            {
                "name": "wait",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/wait/2/json"
            },
            {
                "name": "systemd-logind",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/systemd-logind/8/json"
            },
            {
                "name": "elogind",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/elogind/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 53,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 119,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-h, --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-V, --version",
                        "lines": 31,
                        "flag": "-V",
                        "long": "--version"
                    },
                    {
                        "name": "-N, --noconfig",
                        "lines": 82,
                        "flag": "-N",
                        "long": "--noconfig"
                    },
                    {
                        "name": "-i, --inherit",
                        "lines": 4,
                        "flag": "-i",
                        "long": "--inherit"
                    },
                    {
                        "name": "-U, --unsafe",
                        "lines": 10,
                        "flag": "-U",
                        "long": "--unsafe"
                    },
                    {
                        "name": "-S, --safe",
                        "lines": 5,
                        "flag": "-S",
                        "long": "--safe"
                    },
                    {
                        "name": "-c, --core",
                        "lines": 3,
                        "flag": "-c",
                        "long": "--core"
                    },
                    {
                        "name": "--nocore",
                        "lines": 4,
                        "long": "--nocore"
                    },
                    {
                        "name": "-r, --respawn",
                        "lines": 24,
                        "flag": "-r",
                        "long": "--respawn"
                    },
                    {
                        "name": "--idiot",
                        "lines": 12,
                        "long": "--idiot"
                    },
                    {
                        "name": "-f, --foreground",
                        "lines": 13,
                        "flag": "-f",
                        "long": "--foreground"
                    },
                    {
                        "name": "-B, --bind",
                        "lines": 49,
                        "flag": "-B",
                        "long": "--bind"
                    },
                    {
                        "name": "--ignore-eof",
                        "lines": 12,
                        "long": "--ignore-eof"
                    },
                    {
                        "name": "--read-eof",
                        "lines": 12,
                        "long": "--read-eof"
                    },
                    {
                        "name": "--running",
                        "lines": 23,
                        "long": "--running"
                    },
                    {
                        "name": "--restart",
                        "lines": 10,
                        "long": "--restart"
                    },
                    {
                        "name": "--stop",
                        "lines": 19,
                        "long": "--stop"
                    },
                    {
                        "name": "--list",
                        "lines": 61,
                        "long": "--list"
                    }
                ]
            },
            {
                "name": "EXPANSION",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 73,
                "subsections": []
            },
            {
                "name": "MESSAGING",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "CAVEAT",
                "lines": 36,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "daemon - turns other processes into daemons\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "usage: daemon [options] [--] [cmd arg...]\noptions:\n\n-h, --help                - Print a help message then exit\n-V, --version             - Print a version message then exit\n-v, --verbose[=level]     - Set the verbosity level\n-d, --debug[=level]       - Set the debugging level\n\n-C, --config=path         - Specify the system configuration file\n-N, --noconfig            - Bypass the system configuration file\n-n, --name=name           - Guarantee a single named instance\n-X, --command=\"cmd\"       - Specify the client command as an option\n-P, --pidfiles=/dir       - Override standard pidfile location\n-F, --pidfile=/path       - Override standard pidfile name and location\n\n-u, --user=user[:[group]] - Run the client as user[:group]\n-R, --chroot=path         - Run the client with path as root\n-D, --chdir=path          - Run the client in directory path\n-m, --umask=umask         - Run the client with the given umask\n-e, --env=\"var=val\"       - Set a client environment variable\n-i, --inherit             - Inherit environment variables\n-U, --unsafe              - Allow execution of unsafe executable\n-S, --safe                - Disallow execution of unsafe executable\n-c, --core                - Allow core file generation\n--nocore              - Disallow core file generation (default)\n\n-r, --respawn             - Respawn the client when it terminates\n-a, --acceptable=#        - Minimum acceptable client duration (seconds)\n-A, --attempts=#          - Respawn # times on error before delay\n-L, --delay=#             - Delay between respawn attempt bursts (seconds)\n-M, --limit=#             - Maximum number of respawn attempt bursts\n--idiot               - Idiot mode (trust root with the above)\n\n-f, --foreground          - Run the client in the foreground\n-p, --pty[=noecho]        - Allocate a pseudo terminal for the client\n\n-B, --bind                - Stop when the user's last logind session ends\n\n-l, --errlog=spec         - Send daemon's error output to syslog or file\n-b, --dbglog=spec         - Send daemon's debug output to syslog or file\n-o, --output=spec         - Send client's output to syslog or file\n-O, --stdout=spec         - Send client's stdout to syslog or file\n-E, --stderr=spec         - Send client's stderr to syslog or file\n\n--ignore-eof          - After SIGCHLD ignore any client output\n--read-eof            - After SIGCHLD read any client output (default)\n\n--running             - Check if a named daemon is running\n--restart             - Restart a named daemon client\n--stop                - Terminate a named daemon process\n--signal=signame      - Send a signal to a named daemon\n--list                - Print a list of named daemons\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "daemon(1) turns other processes into daemons. There are many tasks that need to be performed\nto correctly set up a daemon process. This can be tedious. daemon performs these tasks for\nother processes.\n\nThe preparatory tasks that daemon performs for other processes are:\n\n•   First,  revoke  any  setuid or setgid privileges that daemon may have been installed with\n(by system administrators who laugh in the face of danger).\n\n•   Process command line options.\n\n•   Change the root directory if the --chroot option was supplied.\n\n•   Change the process uid and gid if the --user option was supplied. Only root can use  this\noption.  Note that the uid of daemon itself is changed, rather than just changing the uid\nof the client process.\n\n•   Read the system  configuration  file(s)  (/etc/daemon.conf  and  /etc/daemon.conf.d/*  by\ndefault, or specified by the --config option), unless the --noconfig option was supplied.\nThen read the user's personal configuration file(s) (~/.daemonrc and ~/.daemonrc.d/*), if\nany.   Generic  options  that apply to all daemons are processed first, then options that\nare specific to the daemon with the given name. Note: The root  directory  and  the  user\nmust  be  set before access to the configuration file(s) can be attempted, so neither the\n--chroot nor --user options may appear in the configuration file.\n\nOn   BSD   systems   (except   macOS),   the    system    configuration    file(s)    are\n/usr/local/etc/daemon.conf and /usr/local/etc/daemon.conf.d/* by default.\n\nOn   macOS,   when   installed   via  macports,  the  system  configuration  file(s)  are\n/opt/local/etc/daemon.conf and /opt/local/etc/daemon.conf.d/*.\n\n•   Disable core file generation to prevent  leaking  potentially  sensitive  information  in\ndaemons that are run by root (unless the --core option was supplied).\n\n•   Become a daemon process:\n\n•   If  daemon  was  not  invoked by init(8) (i.e. parent process id 1) or inetd(8) (i.e.\nstdin is a socket):\n\n•   Ignore SIGHUP signals in case the current process session leader terminates while\nattached to a controlling terminal, causing us to receive a SIGHUP signal  before\nwe start our own process session below.\n\nThis can happen when daemon was invoked interactively via the shell builtin exec.\nWhen  this  initial  process terminates below, the terminal emulator that invoked\nthe shell also terminates, so daemon need to protect itself from that.\n\n•   Background the process to lose process group leadership.\n\n•   Start a new process session.\n\n•   Background the process again to lose process session leadership. Under SVR4, this\nprevents the process from ever gaining a  controlling  terminal.   This  is  only\nnecessary  under  SVR4,  but  is  always done for simplicity.  Note that ignoring\nSIGHUP signals earlier means that when the newly created process  session  leader\nterminates,  then  even  if  it  has  a  controlling  terminal  open,  the  newly\nbackgrounded process won't receive the corresponding SIGHUP signal that  is  sent\nto  all  processes  in the process session's foreground process group, because it\ninherited signal dispositions from the initial process.\n\n•   Change the current directory to the root directory so as not to hamper umounts.\n\n•   Clear the umask to enable explicit file creation modes.\n\n•   Close all open file descriptors. If daemon was invoked by inetd(8), stdin, stdout and\nstderr are left open, because they are open to a socket.\n\n•   Open stdin, stdout and stderr to /dev/null, in case something  requires  them  to  be\nopen. Of course, this is not done if daemon was invoked by inetd(8).\n\n•   If  the  --name option was supplied, create and lock a file containing the process id\nof the daemon process. The presence of this locked file prevents two instances  of  a\ndaemon  with the same name from running at the same time. The default location of the\npidfile is /var/run for root (/etc  on  Solaris,  /opt/local/var/run  on  macOS  when\ninstalled  via  macports),  and  /tmp  for normal users. If the --pidfiles option was\nsupplied, its argument specifies the directory in which the pidfile will  be  placed.\nIf  the --pidfile option was supplied, its argument specifies the name of the pidfile\nand the directory in which it will be placed.\n\n•   If the --umask option was supplied, set the umask to its argument, which must be a  valid\nthree-digit  octal  mode.  Otherwise,  set  the  umask  to  022,  to prevent clients from\naccidentally creating group- or world-writable files.\n\n•   Set the current directory if the --chdir option was supplied.\n\n•   Spawn the client command and wait  for  it  to  terminate.  The  client  command  can  be\nspecified  as command line arguments, or as the argument of the --command option. If both\nthe --command option and command line arguments are present, the client  command  is  the\nresult of appending the command line arguments to the argument of the --command option.\n\n•   If  the  --output,  --stdout and/or --stderr options were supplied, the client's standard\noutput and/or standard error are captured by daemon,  and  are  sent  to  the  respective\nsyslog destinations.\n\n•   When  the  client terminates, daemon respawns it if the --respawn option was supplied. If\nthe client ran for less than 300 seconds (or the value of the --acceptable option),  then\ndaemon sees this as a failure. It will attempt to restart the client up to five times (or\nthe  value of the --attempts option), before waiting for 300 seconds (or the value of the\n--delay option). This gives the system administrator the chance to  correct  whatever  is\npreventing  the client from running successfully without overloading system resources. If\nthe --limit option was supplied, daemon terminates after the specified number of  respawn\nattempt bursts.  The default is zero, which means never give up, never surrender.\n\nWhen  the  client terminates, and the --respawn option wasn't supplied, daemon terminates\nas well.\n\n•   If daemon receives a SIGTERM signal (e.g. from a separate invocation of daemon  with  the\n--stop option), it propagates the signal to the client and then terminates.\n\n•   If  daemon  receives  a  SIGUSR1  signal  (from  a separate invocation of daemon with the\n--restart option), it sends a SIGTERM signal to the client. If it was  started  with  the\n--respawn  option,  the  client  process  will be restarted after it is terminated by the\nSIGTERM signal.\n\n•   If the --foreground option was supplied, the  client  process  is  run  as  a  foreground\nprocess,  and  is  not turned into a daemon at all. If daemon is connected to a terminal,\nthen the client process will also be connected to it. If daemon is  not  connected  to  a\nterminal, but the client needs to be connected to a terminal, use the --pty option.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-h, --help",
                        "content": "Display a help message and exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-V, --version",
                        "content": "Display a version message and exit.\n\n-v[level], --verbose[=level]\nSet  the  message  verbosity  level  to  level (or 1 if level is not supplied). This only\neffects the --running and --list options.\n\n-d[level], --debug[=level]\nSet the debug message level to level (or 1 if level is not  supplied).   Level  1  traces\nhigh-level   function  calls.  Level  2  traces  lower-level  function  calls  and  shows\nconfiguration information. Level 3 adds environment variables. Level 9 adds every  return\nvalue  from  select(2).  Debug  messages  are  sent  to  the destination specified by the\n--dbglog option (by default, the syslog(3) facility, daemon.debug).\n\n-C path, --config=path\nSpecify the system configuration file to use. By default, /etc/daemon.conf is the  system\nconfiguration  file, if it exists and is not group- or world-writable, and does not exist\nin a group- or world-writable  directory.  The  configuration  file  lets  you  predefine\noptions that apply to all clients, and to specifically named clients.\n\nAs  well  as  the  system configuration file, additional configuration files will be read\nfrom the directory whose path matches the system configuration file with \".d\" appended to\nit (e.g. /etc/daemon.conf.d). Any file in that directory whose name  starts  with  a  dot\ncharacter  (\".\")  is ignored.  The same checks as described above apply to these files as\nwell.\n\nOn   BSD   systems   (except   macOS),   the    system    configuration    file(s)    are\n/usr/local/etc/daemon.conf and /usr/local/etc/daemon.conf.d/* by default.\n\nOn   macOS,   when   installed   via  macports,  the  system  configuration  file(s)  are\n/opt/local/etc/daemon.conf and /opt/local/etc/daemon.conf.d/*.\n",
                        "flag": "-V",
                        "long": "--version"
                    },
                    {
                        "name": "-N, --noconfig",
                        "content": "Bypass the system configuration files, /etc/daemon.conf  and  /etc/daemon.conf.d/*.  Only\nthe  user's  ~/.daemonrc  and  ~/.daemonrc.d/*  configuration files will be read (if they\nexist).\n\n-n name, --name=name\nCreate and lock a pidfile (name.pid), ensuring that only one daemon with the  given  name\nis  active  at  the  same time. The standard location of the pidfile is /var/run for root\n(/etc on Solaris, /opt/local/var/run on macOS when installed via macports), and /tmp  for\nnormal users. This location can be overridden with the --pidfiles option.\n\nThe name may only consist of the following characters:\n\n-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\n\nWhile  a  named daemon's client process is running, there will also be a separate pidfile\nto record the process id of the client process. Its filename will  be  the  same  as  the\ndaemon pidfile's, except that the filename extension will be .clientpid rather than .pid.\nThe  only reason that there should be a .pid file, with no .clientpid file, is during the\ndelay between respawn attempts bursts.\n\n-X \"cmd\", --command=\"cmd\"\nSpecify the client command as an option. If a command is specified along with its name in\nthe configuration file, then a daemon can be invoked merely by mentioning its name:\n\ndaemon --name ftumch\n\nNote: If the client command is  specified  with  the  --command  option,  either  in  the\nconfiguration file, or on the command line, then any additional command line arguments on\nthe  daemon  command  line  are appended to the client command that is specified with the\n--command option.\n\n-P /dir, --pidfiles=/dir\nOverride the standard pidfile location. The standard pidfile  location  is  /var/run  for\nroot (/etc on Solaris, /opt/local/var/run on macOS when installed via macports), and /tmp\nfor normal users.\n\nThis option only affects the --name and --list options. Use this option if these standard\nlocations  are  unacceptable,  but  make  sure  that  you don't forget where you put your\npidfiles. This option is best used in configuration files, or in  shell  scripts,  rather\nthan on an interactive command line.\n\nThe  pidfile  location will be created automatically only if it is within the user's home\ndirectory.\n\n-F /path, --pidfile=/path\nOverride the standard pidfile  name  and  location.  The  standard  pidfile  location  is\ndescribed  immediately  above.  The  standard  pidfile name is the argument of the --name\noption followed by .pid. Use this option if the standard pidfile name  and  location  are\nunacceptable, but make sure that you don't forget where you put your pidfile. This option\nis  best  used in configuration files, or in shell scripts, rather than on an interactive\ncommand line.\n\nThe pidfile location will be created automatically only if it is within the  user's  home\ndirectory.\n\n-u user[:[group]], --user=user[:[group]]\nRun  the  client  as  a  different  user  (and  group). This only works for root.  If the\nargument includes a :group specifier, daemon will  assume  the  specified  group  and  no\nother.  Otherwise,  daemon  will  assume  all  groups  that the specified user is in. For\nbackwards compatibility, \".\" may be used instead of \":\" to separate the  user  and  group\nbut  since  \".\"  can  appear in user and group names, ambiguities can arise such as using\n--user=u.g when users u and u.g and group g all exist. With  such  an  ambiguity,  daemon\nwill assume the user u and group g. Use --user=u.g: instead for the other interpretation.\n\n-R path, --chroot=path\nChange  the  root directory to path before running the client. On some systems, only root\ncan do this. Note that the path to the client program and to the configuration  file  (if\nany) must be relative to the new root path.\n\n-D path, --chdir=path\nChange  the  current  directory  to  path  before running the client. The default current\ndirectory is the root directory (possibly after chroot).\n\n-m umask, --umask=umask\nChange the umask to umask before running the client. umask must be a  valid  octal  mode.\nThe default umask is 022.\n\n-e \"var=val\", --env=\"var=val\"\nSet an environment variable for the client process. This option can be used any number of\ntimes.  If  it  is used, only the supplied environment variables are passed to the client\nprocess. Otherwise, the client process inherits the current set of environment variables.\n",
                        "flag": "-N",
                        "long": "--noconfig"
                    },
                    {
                        "name": "-i, --inherit",
                        "content": "Explicitly inherit environment variables. This is only needed when the  --env  option  is\nused.  When  this  option  is  used,  the --env option adds to the inherited environment,\nrather than replacing it.\n",
                        "flag": "-i",
                        "long": "--inherit"
                    },
                    {
                        "name": "-U, --unsafe",
                        "content": "Allow reading an unsafe  configuration  file,  and  allow  the  execution  of  an  unsafe\nexecutable. A configuration file or executable is considered to be unsafe if it is group-\nor  world-writable  or  is  in  a  directory  that is group- or world-writable (following\nsymbolic links). If an executable is a script that is interpreted by another  executable,\nthen  it  is  considered to be unsafe if the interpreter is unsafe. If the interpreter is\n/usr/bin/env (with an argument that is a command name to be searched for in $PATH),  then\nthat  command  must  be  safe.  By  default,  daemon(1)  will  refuse  to  read an unsafe\nconfiguration file or to execute an unsafe executable  when  run  by  root.  This  option\noverrides that behaviour and hence should never be used.\n",
                        "flag": "-U",
                        "long": "--unsafe"
                    },
                    {
                        "name": "-S, --safe",
                        "content": "Disallow  reading  an  unsafe configuration file, and disallow the execution of an unsafe\nexecutable. By default, daemon(1) will allow reading an unsafe  configuration  file,  and\nallow  the  execution  of  an  unsafe  executable,  when run by normal users. This option\noverrides that behaviour.\n",
                        "flag": "-S",
                        "long": "--safe"
                    },
                    {
                        "name": "-c, --core",
                        "content": "Allow the client to create a core file. This should only be used  for  debugging,  as  it\ncould lead to security-related information disclosures by daemons run by root.\n",
                        "flag": "-c",
                        "long": "--core"
                    },
                    {
                        "name": "--nocore",
                        "content": "By  default,  clients  are  prevented from creating a core file. If the --core option has\nbeen used in a configuration file to apply to all named daemons, then this option can  be\nused to restore the default behaviour for specific named daemons.\n",
                        "long": "--nocore"
                    },
                    {
                        "name": "-r, --respawn",
                        "content": "Respawn  the  client when it terminates. Without this option, the termination of a client\nprocess causes daemon itself to terminate as well.\n\n-a #, --acceptable=#\nSpecify the minimum acceptable duration of a client process, in seconds.  This option can\nonly be used with the --respawn option.  If  a  client  process  terminates  before  this\nthreshold  is  reached,  then  it  is considered to have failed. The default value is 300\nseconds. It cannot be set  to  less  than  10  seconds,  except  by  root  when  used  in\nconjunction with the --idiot option.\n\n-A #, --attempts=#\nSpecify  the  number of attempts to respawn before delaying. This option can only be used\nwith the --respawn option. The default value is 5. It cannot be  set  to  more  than  100\nattempts, except by root when used in conjunction with the --idiot option.\n\n-L #, --delay=#\nSpecify the delay in seconds between each burst of respawn attempts. This option can only\nbe  used with the --respawn option. The default value is 300 seconds. It cannot be set to\nless than 10 seconds except by root when used in conjunction with the --idiot option.\n\n-M #, --limit=#\nSpecify a limit to the number of respawn attempt bursts. This option  can  only  be  used\nwith the --respawn option. The default value is 0, which means no limit.\n",
                        "flag": "-r",
                        "long": "--respawn"
                    },
                    {
                        "name": "--idiot",
                        "content": "Turn  on  idiot  mode  in  which  daemon  will  not enforce the minimum or maximum values\nnormally imposed on the --acceptable, --attempts and --delay options. The --idiot  option\nmust  appear before any of these options. Only the root user may use this option, because\nit can turn a slight misconfiguration into a lot of wasted CPU energy and  log  messages,\nsomewhat akin to a self-inflicted denial of service.\n\nIdiot  mode  also allows the root user to expand environment variable notation (e.g. $VAR\nand ${VAR}) in command line option arguments, and in  configuration  files.  By  default,\ninternal  environment  variable  expansion  is only performed for normal users. Note that\nthis doesn't apply to any such expansion performed earlier  by  the  shell  that  invokes\ndaemon(1). See the EXPANSION section below for more details.\n",
                        "long": "--idiot"
                    },
                    {
                        "name": "-f, --foreground",
                        "content": "Run the client in the foreground. The client is not turned into a daemon.\n\n-p[noecho], --pty[=noecho]\nConnect  the  client  to  a  pseudo  terminal.  This  option  can  only  be used with the\n--foreground option. This is the default when the --foreground  option  is  supplied  and\ndaemon's  standard  input  is connected to a terminal. This option is only necessary when\nthe client process must be connected to a controlling terminal,  but  daemon  itself  has\nbeen run without a controlling terminal (e.g. from cron(8) or a pipeline).\n\nIf  the  noecho  argument  is  supplied with this option, the client's side of the pseudo\nterminal will be set to noecho mode. Use this only if there really is a terminal involved\nand input is being echoed twice.\n",
                        "flag": "-f",
                        "long": "--foreground"
                    },
                    {
                        "name": "-B, --bind",
                        "content": "Automatically terminate the client process (and daemon(1) itself) as soon as the user has\nno systemd-logind(8)  (or  elogind(8))  user  sessions.  In  other  words,  automatically\nterminate  when  the user logs out. If the user has no sessions to start with, the client\nprocess will be terminated immediately.\n\nThis option is only available on Linux systems that have either systemd(1) (e.g.  Debian)\nor  elogind(8)  (e.g.  Slackware).  On  systems  with systemd(1), you could instead use a\nsystemd user service, particularly if your user account  is  not  allowed  to  have  user\nservices that linger.\n\n-l spec, --errlog=spec\nSend  daemon's  standard output and standard error to the syslog destination or file that\nis specified by spec. If spec is a syslog destination of  the  form  \"facility.priority\",\nthen output is sent to syslog(3). Otherwise, output is appended to the file whose path is\ngiven  in spec. By default, output is sent to the syslog destination, daemon.err. See the\nMESSAGING section below for more details.\n\n-b spec, --dbglog=spec\nSend daemon's debug output to the syslog destination or file that is specified  by  spec.\nIf  spec  is a syslog destination of the form \"facility.priority\", then output is sent to\nsyslog(3). Otherwise, output is appended to the file whose path  is  given  in  spec.  By\ndefault, output is sent to the syslog destination daemon.debug. See the MESSAGING section\nbelow for more details.\n\n-o spec, --output=spec\nCapture  the  client's  standard  output  and  standard  error, and send it to the syslog\ndestination or file that is specified by spec. If spec is a  syslog  destination  of  the\nform \"facility.priority\", then output is sent to syslog(3). Otherwise, output is appended\nto  the  file  whose  path  is  given in spec. By default, output is discarded unless the\n--foreground option is present, in  which  case,  the  client's  stdout  and  stderr  are\npropagated  to  daemon's stdout and stderr, respectively. See the MESSAGING section below\nfor more details.\n\n-O spec, --stdout=spec\nCapture the client's standard output, and send it to the syslog destination or file  that\nis  specified  by  spec. If spec is a syslog destination of the form \"facility.priority\",\nthen output is sent to syslog(3).  Otherwise, stdout is appended to the file  whose  path\nis  given  in  spec.  By  default,  stdout is discarded unless the --foreground option is\npresent, in which case, the client's stdout is propagated to  daemon's  stdout.  See  the\nMESSAGING section below for more details.\n\n-E spec, --stderr=spec\nCapture  the  client's standard error, and send it to the syslog destination or file that\nis specified by spec. If spec is a syslog destination of  the  form  \"facility.priority\",\nthen  stderr  is sent to syslog(3).  Otherwise, stderr is appended to the file whose path\nis given in spec. By default, stderr is  discarded  unless  the  --foreground  option  is\npresent,  in  which  case,  the client's stderr is propagated to daemon's stderr. See the\nMESSAGING section below for more details.\n",
                        "flag": "-B",
                        "long": "--bind"
                    },
                    {
                        "name": "--ignore-eof",
                        "content": "After receiving a SIGCHLD signal due to a stopped  or  restarted  client  process,  don't\nbother  reading  the  client's output until the end-of-file is reached before reaping the\nclient process's termination status with wait(2). Normally, there will be  little  or  no\noutput after the SIGCHLD signal, because the client process has just terminated. However,\nthe  client process might have its own child processes keeping its output open long after\nits own termination. When this happens, by default,  the  client  process  remains  as  a\nzombie  process until its child processes terminate and close the output. Waiting for the\nclient's child processes to terminate before considering the client stopped,  and  before\nrestarting  a  new  invocation,  might  be  desirable. If not, this option can be used to\nconsider the client process as being terminated as soon as the SIGCHLD  signal  has  been\nreceived, and reaping its termination status with wait(2) immediately.\n",
                        "long": "--ignore-eof"
                    },
                    {
                        "name": "--read-eof",
                        "content": "After  receiving  a SIGCHLD signal due to a stopped or restarted client process, continue\nreading the client's output until the end-of-file is reached before  reaping  the  client\nprocess's termination status with wait(2). This is the default behaviour. Normally, there\nwill be little or no output after the SIGCHLD signal, because the client process has just\nterminated.  However,  the  client process might have its own child processes keeping its\noutput open long after its own termination. When this happens, the client process remains\nas a zombie process until its child processes terminate and close the output. Waiting for\nthe client's child processes to terminate before  considering  the  client  stopped,  and\nbefore  restarting  a  new  invocation,  might  be desirable. If so, but the --ignore-eof\noption has been used in a configuration file to apply to all  named  daemons,  then  this\noption can be used to restore the default behaviour for specific named daemons.\n",
                        "long": "--read-eof"
                    },
                    {
                        "name": "--running",
                        "content": "Check  whether  or  not  a named daemon is running, then exit(3) with EXITSUCCESS if the\nnamed daemon is running or EXITFAILURE if it isn't.\n\nIf the --verbose option is supplied, print a message before exiting. If  both  the  named\ndaemon  and  its client process are running, the output will look like this, showing both\nprocess IDs:\n\ndaemon:  name is running (pid 7455) (clientpid 7457)\n\nIf the named daemon is running but its client process is not  (there  might  be  a  delay\nbetween  respawn attempt bursts), the output will look like this, showing only the daemon\nprocess's ID:\n\ndaemon:  name is running (pid 7455) (client is not running)\n\nIf the named daemon is not running at all, the output will look like this:\n\ndaemon:  name is not running\n\nThis option can only be used with the --name option.  Note  that  the  --chroot,  --user,\n--name,  --pidfiles and --pidfile (and possibly --config) options must be the same as for\nthe target daemon.\n",
                        "long": "--running"
                    },
                    {
                        "name": "--restart",
                        "content": "Instruct a named daemon to terminate and restart its client  process,  by  sending  it  a\nSIGUSR1  signal.  This  will  cause the named daemon to send its client process a SIGTERM\nsignal to stop it. If the named daemon had been started with the  --restart  option,  the\nnamed daemon will then restart its client process. Otherwise, this has the same effect as\nthe --stop option, and the named daemon's client process is not restarted.\n\nThis  option  can  only  be  used with the --name option. Note that the --chroot, --user,\n--name, --pidfiles and --pidfile (and possibly --config) options must be the same as  for\nthe target daemon.\n",
                        "long": "--restart"
                    },
                    {
                        "name": "--stop",
                        "content": "Stop  a  named daemon by sending it a SIGTERM signal. This will cause the named daemon to\nsend its client process a SIGTERM option and then exit.\n\nThis option can only be used with the --name option.  Note  that  the  --chroot,  --user,\n--name,  --pidfiles and --pidfile (and possibly --config) options must be the same as for\nthe target daemon.\n\n--signal=signame\nSend the given signal to a named daemon's client process. The  signal  can  be  specified\neither  by number or by name (with or without the \"sig\" prefix).  Any signal may be sent.\nHowever, the named daemon's client process might be ignoring some signals.  For  example,\nSIGHUP  will  be  ignored  by  default  unless  the client process has installed a signal\nhandler for it.\n\nThe known list of signals are: hup, int, quit, ill, trap,  abrt,  iot,  bus,  fpe,  kill,\nusr1, segv, usr2, pipe, alrm, term, stkflt, cld, chld, cont, stop, tstp, ttin, ttou, urg,\nxcpu,  xfsz,  vtalrm,  prof, winch, poll, io, pwr, sys, emt and info. Not all of them are\navailable on all platforms.\n",
                        "long": "--stop"
                    },
                    {
                        "name": "--list",
                        "content": "Print a list of the currently running named daemons whose pidfiles are in the  applicable\npidfile  directory  which  will  either  be the default (i.e.  /var/run for root (/etc on\nSolaris, /opt/local/var/run on macOS when installed via macports), and  /tmp  for  normal\nusers), or it will be specified by the --pidfiles option. Then exit.\n\nWithout the --verbose option, this will only list the names of daemons whose pidfiles are\nlocked,  as  this  implies that the corresponding daemon must still be running. Note that\npidfiles for daemons that were not started by daemon(1) might not be locked. An  unlocked\npidfile  might  indicate  that  daemon(1)  has  died  unexpectedly, or it might just be a\npidfile for a daemon that was not started by daemon(1). If this might lead to  confusion,\nyou might want to consider using a dedicated pidfiles directory for named daemons started\nby  daemon(1),  and  leave  the  default pidfiles directories for other daemons that were\nstarted independently of daemon(1).\n\nWith the --verbose option, the items in the  list  will  look  like  the  output  of  the\n--running option with --verbose, but with more detail.\n\nIf there are no pidfiles at all, the output will look like this:\n\nNo named daemons are running\n\nIf  a pidfile is locked, and there is a corresponding client pidfile, that indicates that\nthe named daemon and its client are both running, and the output  will  look  like  this,\nshowing both process IDs:\n\nname is running (pid ####) (client pid ####)\n\nIf  a  pidfile  is  locked, but there is no client pidfile, that indicates that the named\ndaemon is running, but its client is not (e.g. during a  delay  between  respawn  attempt\nbursts  when  the client is failing to start successfully), and the output will look like\none of the following three options:\n\nWhen we can tell that the pidfile is for a process whose executable name is daemon:\n\nname is running (pid ####) (client is not running)\n\nWhen we can tell that the pidfile is for a process whose  executable  name  is  something\nother than daemon (i.e. is independent of daemon(1)):\n\nname is running (pid ####) (independent)\n\nWhen  it's  not  possible  to  determine  the  name of the executable associated with the\npidfile (i.e. On systems other than Linux without a /proc file system):\n\nname is running (pid ####) (client is not running or is independent)\n\nIf a pidfile is not locked, and the applicable pidfiles directory is  the  default,  that\nindicates either that the daemon has unexpectedly terminated, or just that the pidfile is\nfor a daemon that was not started by daemon(1), and the output will look like this:\n\nname is not running (or is independent)\n\nIf  a  pidfile  is  not locked, and the applicable pidfiles directory is not the default,\nthen it is assumed that all pidfiles are for daemons that were started by daemon(1),  and\nthe output will look like this:\n\nname is not running\n\nAs  with  all  other  programs, a -- argument signifies the end of options.  Any options that\nappear on the command line after -- are part of the client command.\n",
                        "long": "--list"
                    }
                ]
            },
            "EXPANSION": {
                "content": "Some simple shell-like expansion is performed internally on the arguments of the command line\noptions with a text argument (but not the options with a numeric argument).\n\nEnvironment variable notation, such as $VAR or ${VAR}, is expanded.  Then user home directory\nnotation, such as ~ or ~user, is expanded.   File  name  expansion  (i.e.  globbing)  is  NOT\nperformed  internally. Neither are any of your login shell's other wonderful expansions. This\nis very basic.\n\nThis might not be of much use on the command line, since daemon is  normally  invoked  via  a\nshell,  which will first perform all of its usual expansions. It might even be undesirable to\nperform expansion internally after the shell has already done so (e.g. if you  refer  to  any\ndirectory  names  that  actually  contain  the  '$'  character, or if you use any environment\nvariables whose values contain the '$' character, which is unlikely).\n\nBut it can be useful in configuration files. See the FILES section below for more details. It\ncan also be useful when daemon is invoked directly by another program without the  use  of  a\nshell.\n\nBy  default,  environment  variable expansion is not performed for the root user, even if the\nenvironment variable was defined in the configuration files. The --idiot option can  be  used\nto change this behaviour, and allow the expansion of environment variables for the root user.\nHome directory notation expansion is performed for all users.\n",
                "subsections": []
            },
            "FILES": {
                "content": "/etc/daemon.conf, /etc/daemon.conf.d/* - system-wide default options\n\n/usr/local/etc/daemon.conf,  /usr/local/etc/daemon.conf.d/*  - system-wide default options on\nBSD systems (except macOS).\n\n/opt/local/etc/daemon.conf, /opt/local/etc/daemon.conf.d/* - system-wide default  options  on\nmacOS when installed via macports.\n\n~/.daemonrc, ~/.daemonrc.d/* - user-specific default options\n\nEach  line  of  the  configuration  file  is  either an environment variable definition, or a\nconfiguration directive.\n\nEnvironment variable definitions consist of the variable name, followed  immediately  by  '='\nand  the  value  of  the  variable.  They look like they do in shell, except that there is no\nquoting or other shell syntax. Environment variable values  can  include  simple  environment\nvariable notation (e.g.  $VAR or ${VAR}), and user home directory notation (e.g. ~ or ~user).\nThese  will  be  expanded  internally  by  daemon.  See  the EXPANSION section above for more\ndetails.\n\nNote that any environment variables that are defined in the  configuration  file,  which  are\nsubsequently  used  explicitly  in  another  environment  variable definition or in an option\nargument, will have these expansions performed multiple times.  Avoid  environment  variables\nwhose values can change again if expansion is performed multiple times.\n\nExample:\n\nPATH=/usr/bin:/usr/sbin:$HOME/bin:~app/bin\nPIDFILES=~/.run\n\nConfiguration  directives  consist  of  a  client  name  (for  options that apply to a single\nclient), or '*' (for generic options that apply to all clients), followed  by  spaces  and/or\ntabs,  followed  by  a comma-separated list of options. Any option arguments must not contain\nany commas. The commas that separate options can have spaces and tabs before and after  them.\nOption  arguments  that  are  text  (but not numbers) can include simple environment variable\nnotation (e.g. $VAR or ${VAR}), and user home directory notation (e.g.  ~  or  ~user).  These\nwill be expanded internally by daemon. See the EXPANSION section above for more details.\n\nBlank  lines and comments ('#' to end of the line) are ignored. Lines can be continued with a\n'\\' character at the end of the line.\n\nExample:\n\n*       errlog=daemon.err,output=local0.err,core\ntest1   syslog=local0.debug,debug=9,verbose=9,respawn\ntest2   syslog=local0.debug,debug=9, \\\nverbose=9,respawn, \\\npidfiles=$PIDFILES\n\nThe command line options are processed first, to look for a --config option. If  no  --config\noption    was    supplied,    the   default   configuration   files,   /etc/daemon.conf   and\n/etc/daemon.conf.d/*, are used. On BSD systems  (except  macOS),  the  default  configuration\nfiles  are  /usr/local/etc/daemon.conf  and  /usr/local/etc/daemon.conf.d/*.  On  macOS  when\ninstalled via macports, the default configuration files  are  /opt/local/etc/daemon.conf  and\n/opt/local/etc/daemon.conf.d/*.   If  the user has their own configuration files, ~/.daemonrc\nand ~/.daemonrc.d/*, they are also used.\n\nIf the configuration files contain any generic ('*') entries, their options  are  applied  in\norder  of  appearance. If the --name option was supplied, and the configuration files contain\nany entries for the given name, those options are then applied in order of appearance.\n\nFinally, the command line options are applied again. This ensures that  any  generic  options\napply  to  all  clients  by  default.  Client-specific options override generic options. User\noptions override system-wide options. Command line options override everything else.\n\nNote that the configuration files are not opened and read until  after  any  --chroot  and/or\n--user  command  line options are processed. This means that the configuration file paths and\nthe client's file path must be relative to the --chroot argument.  It  also  means  that  the\nconfiguration  files  and  the  client  executable  must  be  readable/executable by the user\nspecified by the --user argument. It also means that the --chroot and --user options must not\nappear in the configuration file. Also note that the --name option must  not  appear  on  the\nright hand side in the configuration file either.\n",
                "subsections": []
            },
            "MESSAGING": {
                "content": "The --errlog, --dbglog, --output, --stdout and --stderr options all take an argument that can\nbe  either  a  syslog destination of the form \"facility.priority\" or the path to a file. Here\nare the lists of syslog facilities and priorities:\n\nFacilities:\nkern, user, mail, daemon, auth, syslog, lpr, news, uucp, cron,\nlocal0, local1, local2, local3, local4, local5, local6, local7.\n\nPriorities:\nemerg, alert, crit, err, warning, notice (on some systems), info, debug.\n\nIf the path to a file is supplied instead, bear in mind the fact that  daemon(1)  changes  to\nthe  root  directory by default, and so the file path should be an absolute path (or relative\nto the --chroot and/or --chdir option argument). Otherwise, daemon(1) will attempt to  create\nthe  file  relative  to  its current directory. You might not have permissions to do that, or\nwant to even if you do.\n",
                "subsections": []
            },
            "CAVEAT": {
                "content": "Clients can only be restarted if they were started with the --respawn option. Using --restart\non a non-respawning daemon client is equivalent to using --stop. If  you  try  to  restart  a\nnamed  daemon,  and  it  stops  instead,  then  it probably wasn't started with the --respawn\noption.\n\nClients that are run in the foreground with a pseudo terminal don't respond  to  job  control\n(i.e.  suspending  with  Control-Z  doesn't  work).  This is because the client belongs to an\norphaned process group (it starts in its own process session), so the kernel  won't  send  it\nSIGSTOP  signals.   However,  if  the  client  is a shell that supports job control, then its\nsubprocesses can be suspended.\n\nIn KDE, if you use \"exec daemon\" (or just \"exec\" without daemon) in a shell,  to  run  a  KDE\napplication,  you might find that the KDE application sometimes doesn't run. This problem has\nonly been seen with konsole(1), but it might happen with  other  KDE  applications  as  well.\nCapturing the standard error of the KDE application might show something like:\n\nunnamed app(9697): KUniqueApplication: Registering failed!\nunnamed app(9697): Communication problem with  \"konsole\" , it probably crashed.\nError message was:  \"org.freedesktop.DBus.Error.ServiceUnknown\" : \" \"The name\norg.kde.konsole was not provided by any .service files\"\n\nA  workaround  seems  to  be  to delay the termination of the initial daemon(1) process by at\nleast   0.4   seconds.   To   make   this    happen,    set    the    environment    variable\nDAEMONINITEXITDELAYMSEC  to  the  number  of milliseconds by which to delay. For example:\nDAEMONINITEXITDELAYMSEC=400. Or you  could  just  avoid  using  exec  when  starting  KDE\napplications.\n\nOn  Linux  systems  that  have  systemd(1)  or  elogind(8),  you  might find that your daemon\nprocesses and their client processes are terminated when you logout, even though they are  in\na  different  process  session,  and so should be unaffected. This is because systemd has the\nability to terminate all of your processes when you logout. Luckily, this feature  is  turned\noff  by  default  in  some  Linux distributions. However, if it is on, you can turn it off by\nadding the following line to /etc/systemd/logind.conf (or /etc/elogind/logind.conf):\n\nKillUserProcesses=no\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "libslack(3),  daemon(3),  coproc(3),  pseudo(3),  init(8),   inetd(8),   fork(2),   umask(2),\nsetsid(2),   chdir(2),   chroot(2),   setrlimit(2),   setgid(2),   setuid(2),   setgroups(2),\ninitgroups(3), syslog(3), kill(2), wait(2), systemd-logind(8), elogind(8)\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "20230824 raf <raf@raf.org>\n\ndaemon-0.8.4                                  20230824                                     DAEMON(1)",
                "subsections": []
            }
        }
    }
}