せ7> pwd
/usr/lib/systemd
せ7> find . -name "*.socket"
./system/dbus.target.wants/dbus.socket
./system/systemd-shutdownd.socket
./system/sockets.target.wants/systemd-initctl.socket
./system/sockets.target.wants/systemd-journald.socket
./system/sockets.target.wants/systemd-shutdownd.socket
./system/sockets.target.wants/systemd-udevd-control.socket
./system/sockets.target.wants/systemd-udevd-kernel.socket
./system/sockets.target.wants/dbus.socket
./system/syslog.socket
./system/systemd-udevd-control.socket
./system/systemd-udevd-kernel.socket
./system/systemd-initctl.socket
./system/systemd-journald.socket
./system/systemd-networkd.socket
./system/dbus.socket
./system/sshd.socket
./system/dovecot.socket
./system/dm-event.socket
./system/lvm2-lvmetad.socket
./system/lvm2-lvmpolld.socket
せ7> find . -name "*.mount"
./system/dev-hugepages.mount
./system/dev-mqueue.mount
./system/tmp.mount
./system/proc-sys-fs-binfmt_misc.mount
./system/sys-fs-fuse-connections.mount
./system/sys-kernel-config.mount
./system/sys-kernel-debug.mount
./system/sysinit.target.wants/dev-hugepages.mount
./system/sysinit.target.wants/dev-mqueue.mount
./system/sysinit.target.wants/sys-fs-fuse-connections.mount
./system/sysinit.target.wants/sys-kernel-config.mount
./system/sysinit.target.wants/sys-kernel-debug.mount
せ7> man 5 systemd.exec
SYSTEMD.EXEC(5) systemd.exec SYSTEMD.EXEC(5)
NAME
systemd.exec - Execution environment configuration
SYNOPSIS
service.service, socket.socket, mount.mount, swap.swap
DESCRIPTION
Unit configuration files for services, sockets, mount points, and swap devices share a subset of configuration options which define the execution environment of spawned processes.
This man page lists the configuration options shared by these four unit types. See systemd.unit(5) for the common options of all unit configuration files, and systemd.service(5), systemd.socket(5), systemd.swap(5), and systemd.mount(5) for more information on the specific unit configuration files. The execution specific configuration options are configured in the [Service], [Socket], [Mount], or [Swap] sections, depending on the unit type.
OPTIONS
WorkingDirectory=
Takes an absolute directory path. Sets the working directory for executed processes. If not set, defaults to the root directory when systemd is running as a system instance and the respective user's home directory if run as user.
RootDirectory=
Takes an absolute directory path. Sets the root directory for executed processes, with the chroot(2) system call. If this is used, it must be ensured that the process and all its auxiliary files are available in the chroot() jail.
User=, Group=
Sets the Unix user or group that the processes are executed as, respectively. Takes a single user or group name or ID as argument. If no group is set, the default group of the user is chosen.
SupplementaryGroups=
Sets the supplementary Unix groups the processes are executed as. This takes a space-separated list of group names or IDs. This option may be specified more than once in which case all listed groups are set as supplementary groups. When the empty string is assigned the list of supplementary groups is reset, and all assignments prior to this one will have no effect. In any way, this option does not override, but extends the list of supplementary groups configured in the system group database for the user.
Nice=
Sets the default nice level (scheduling priority) for executed processes. Takes an integer between -20 (highest priority) and 19 (lowest priority). See setpriority(2) for details.
OOMScoreAdjust=
Sets the adjustment level for the Out-Of-Memory killer for executed processes. Takes an integer between -1000 (to disable OOM killing for this process) and 1000 (to make killing of this process under memory pressure very likely). See proc.txt[1] for details.
IOSchedulingClass=
Sets the IO scheduling class for executed processes. Takes an integer between 0 and 3 or one of the strings none, realtime, best-effort or idle. See ioprio_set(2) for details.
IOSchedulingPriority=
Sets the IO scheduling priority for executed processes. Takes an integer between 0 (highest priority) and 7 (lowest priority). The available priorities depend on the selected IO scheduling class (see above). See ioprio_set(2) for details.
CPUSchedulingPolicy=
Sets the CPU scheduling policy for executed processes. Takes one of other, batch, idle, fifo or rr. See sched_setscheduler(2) for details.
CPUSchedulingPriority=
Sets the CPU scheduling priority for executed processes. The available priority range depends on the selected CPU scheduling policy (see above). For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority) can be used. See
sched_setscheduler(2) for details.
CPUSchedulingResetOnFork=
Takes a boolean argument. If true, elevated CPU scheduling priorities and policies will be reset when the executed processes fork, and can hence not leak into child processes. See sched_setscheduler(2) for details. Defaults to false.
CPUAffinity=
Controls the CPU affinity of the executed processes. Takes a space-separated list of CPU indices. This option may be specified more than once in which case the specified CPU affinity masks are merged. If the empty string is assigned, the mask is reset, all assignments prior to this will have no effect. See sched_setaffinity(2) for details.
UMask=
Controls the file mode creation mask. Takes an access mode in octal notation. See umask(2) for details. Defaults to 0022.
Environment=
Sets environment variables for executed processes. Takes a space-separated list of variable assignments. This option may be specified more than once in which case all listed variables will be set. If the same variable is set twice, the later setting will override the earlier setting. If the empty string is assigned to this option, the list of environment variables is reset, all prior assignments have no effect.
Variable expansion is not performed inside the strings, however, specifier expansion is possible. The $ character has no special meaning. If you need to assign a value containing spaces to a variable, use double quotes (") for the assignment.
Example:
Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6" gives three variables "VAR1", "VAR2", "VAR3" with the values "word1 word2", "word3", "$word 5 6".
See environ(7) for details about environment variables.
EnvironmentFile=
Similar to Environment= but reads the environment variables from a text file. The text file should contain new-line-separated variable assignments. Empty lines and lines starting with ; or # will be ignored, which may be used for commenting. A line ending with a backslash will
be concatenated with the following one, allowing multiline variable definitions. The parser strips leading and trailing whitespace from the values of assignments, unless you use double quotes (").
The argument passed should be an absolute filename or wildcard expression, optionally prefixed with "-", which indicates that if the file does not exist, it will not be read and no error or warning message is logged. This option may be specified more than once in which case all specified files are read. If the empty string is assigned to this option, the list of file to read is reset, all prior assignments have no effect.
The files listed with this directive will be read shortly before the process is executed (more specifically, after all processes from a previous unit state terminated. This means you can generate these files in one unit state, and read it with this option in the next).
Settings from these files override settings made with Environment=. If the same variable is set twice from these files, the files will be read in the order they are specified and the later setting will override the earlier setting.
StandardInput=
Controls where file descriptor 0 (STDIN) of the executed processes is connected to. Takes one of null, tty, tty-force, tty-fail or socket.
If null is selected, standard input will be connected to /dev/null, i.e. all read attempts by the process will result in immediate EOF.
If tty is selected, standard input is connected to a TTY (as configured by TTYPath=, see below) and the executed process becomes the controlling process of the terminal. If the terminal is already being controlled by another process, the executed process waits until the
current controlling process releases the terminal.
tty-force is similar to tty, but the executed process is forcefully and immediately made the controlling process of the terminal, potentially removing previous controlling processes from the terminal.
tty-fail is similar to tty but if the terminal already has a controlling process start-up of the executed process fails.
The socket option is only valid in socket-activated services, and only when the socket configuration file (see systemd.socket(5) for details) specifies a single socket only. If this option is set, standard input will be connected to the socket the service was activated from, which is primarily useful for compatibility with daemons designed for use with the traditional inetd(8) daemon. This setting defaults to null.
StandardOutput=
Controls where file descriptor 1 (STDOUT) of the executed processes is connected to. Takes one of inherit, null, tty, journal, syslog, kmsg, journal+console, syslog+console, kmsg+console or socket.
inherit duplicates the file descriptor of standard input for standard output. null connects standard output to /dev/null, i.e. everything written to it will be lost. tty connects standard output to a tty (as configured via TTYPath=, see below). If the TTY is used for output only, the executed process will not become the controlling process of the terminal, and will not fail or wait for other processes to release the terminal.
journal connects standard output with the journal which is accessible via journalctl(1). Note that everything that is written to syslog or kmsg (see below) is implicitly stored in the journal as well, the specific two options listed below are hence supersets of this one.
syslog connects standard output to the syslog(3) system syslog service, in addition to the journal. Note that the journal daemon is usually configured to forward everything it receives to syslog anyway, in which case this option is no different from journal.
kmsg connects standard output with the kernel log buffer which is accessible via dmesg(1), in addition to the journal. The journal daemon might be configured to send all logs to kmsg anyway, in which case this option is no different from journal.
journal+console, syslog+console and kmsg+console work in a similar way as the three options above but copy the output to the system console as well.
socket connects standard output to a socket acquired via socket activation. The semantics are similar to the same option of StandardInput=. This setting defaults to the value set with DefaultStandardOutput= in systemd-system.conf(5), which defaults to journal.
StandardError=
Controls where file descriptor 2 (STDERR) of the executed processes is connected to. The available options are identical to those of StandardOutput=, with one exception: if set to inherit the file descriptor used for standard output is duplicated for standard error. This
setting defaults to the value set with DefaultStandardError= in systemd-system.conf(5), which defaults to inherit.
TTYPath=
Sets the terminal device node to use if standard input, output, or error are connected to a TTY (see above). Defaults to /dev/console.
TTYReset=
Reset the terminal device specified with TTYPath= before and after execution. Defaults to "no".
TTYVHangup=
Disconnect all clients which have opened the terminal device specified with TTYPath= before and after execution. Defaults to "no".
TTYVTDisallocate=
If the terminal device specified with TTYPath= is a virtual console terminal, try to deallocate the TTY before and after execution. This ensures that the screen and scrollback buffer is cleared. Defaults to "no".
SyslogIdentifier=
Sets the process name to prefix log lines sent to the logging system or the kernel log buffer with. If not set, defaults to the process name of the executed process. This option is only useful when StandardOutput= or StandardError= are set to syslog, journal or kmsg (or to the same settings in combination with +console).
SyslogFacility=
Sets the syslog facility to use when logging to syslog. One of kern, user, mail, daemon, auth, syslog, lpr, news, uucp, cron, authpriv, ftp, local0, local1, local2, local3, local4, local5, local6 or local7. See syslog(3) for details. This option is only useful when StandardOutput=
or StandardError= are set to syslog. Defaults to daemon.
SyslogLevel=
Default syslog level to use when logging to syslog or the kernel log buffer. One of emerg, alert, crit, err, warning, notice, info, debug. See syslog(3) for details. This option is only useful when StandardOutput= or StandardError= are set to syslog or kmsg. Note that individual lines output by the daemon might be prefixed with a different log level which can be used to override the default log level specified here. The interpretation of these prefixes may be disabled with SyslogLevelPrefix=, see below. For details see sd-daemon(3). Defaults to info.
SyslogLevelPrefix=
Takes a boolean argument. If true and StandardOutput= or StandardError= are set to syslog, kmsg or journal, log lines written by the executed process that are prefixed with a log level will be passed on to syslog with this log level set but the prefix removed. If set to false, the interpretation of these prefixes is disabled and the logged lines are passed on as-is. For details about this prefixing see sd-daemon(3). Defaults to true.
TimerSlackNSec=
Sets the timer slack in nanoseconds for the executed processes. The timer slack controls the accuracy of wake-ups triggered by timers. See prctl(2) for more information. Note that in contrast to most other time span definitions this parameter takes an integer value in nano-seconds if no unit is specified. The usual time units are understood too.
LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=, LimitRSS=, LimitNOFILE=, LimitAS=, LimitNPROC=, LimitMEMLOCK=, LimitLOCKS=,
LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=, LimitRTPRIO=, LimitRTTIME=
These settings set both soft and hard limits of various resources for executed processes. See setrlimit(2) for details. The resource limit is possible to specify in two formats, value to set soft and hard limits to the same value, or soft:hard to set both limits individually (e.g.
LimitAS=4G:16G). Use the string infinity to configure no limit on a specific resource. The multiplicative suffixes K (=1024), M (=1024*1024) and so on for G, T, P and E may be used for resource limits measured in bytes (e.g. LimitAS=16G). For the limits referring to time values, the usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no time unit is specified for LimitCPU= the default unit of seconds is implied, while for LimitRTTIME= the default unit of microseconds is implied. Also, note that the effective granularity of the limits might influence their enforcement. For example, time limits specified for LimitCPU= will be rounded up implicitly to multiples of 1s.
Note that most process resource limits configured with these options are per-process, and processes may fork in order to acquire a new set of resources that are accounted independently of the original process, and may thus escape limits set. Also note that LimitRSS= is not implemented on Linux, and setting it has no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5) over these per-process limits, as they apply to services as a whole, may be altered dynamically at runtime, and are generally more expressive. For example, MemoryLimit= is a more powerful (and working) replacement for LimitRSS=.
Table 1. Limit directives and their equivalent with ulimit
|
Directive |
ulimit equivalent |
Unit |
|---|---|---|
|
LimitCPU= |
ulimit -t |
Seconds |
|
LimitFSIZE= |
ulimit -f |
Bytes |
|
LimitDATA= |
ulimit -d |
Bytes |
|
LimitSTACK= |
ulimit -s |
Bytes |
|
LimitCORE= |
ulimit -c |
Bytes |
|
LimitRSS= |
ulimit -m |
Bytes |
|
LimitNOFILE= |
ulimit -n |
Number of File Descriptors |
|
LimitAS= |
ulimit -v |
Bytes |
|
LimitNPROC= |
ulimit -u |
Number of Processes |
|
LimitMEMLOCK= |
ulimit -l |
Bytes |
|
LimitLOCKS= |
ulimit -x |
Number of Locks |
|
LimitSIGPENDING= |
ulimit -i |
Number of Queued Signals |
|
LimitMSGQUEUE= |
ulimit -q |
Bytes |
|
LimitNICE= |
ulimit -e |
Nice Level |
|
LimitRTPRIO= |
ulimit -r |
Realtime Priority |
|
LimitRTTIME= |
No equivalent |
Microseconds |