]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.syntax.xml
test-network: use udevd in build directory
[thirdparty/systemd.git] / man / systemd.syntax.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 <!ENTITY % entities SYSTEM "custom-entities.ent" >
5 %entities;
6 ]>
7 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
8
9 <refentry id="systemd.syntax">
10
11 <refentryinfo>
12 <title>systemd.syntax</title>
13 <productname>systemd</productname>
14 </refentryinfo>
15
16 <refmeta>
17 <refentrytitle>systemd.syntax</refentrytitle>
18 <manvolnum>7</manvolnum>
19 </refmeta>
20
21 <refnamediv>
22 <refname>systemd.syntax</refname>
23 <refpurpose>General syntax of systemd configuration files</refpurpose>
24 </refnamediv>
25
26 <refsect1>
27 <title>Introduction</title>
28
29 <para>This page describes the basic principles of configuration files used by
30 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
31 and related programs for:
32 <itemizedlist>
33 <listitem><para>systemd unit files, see
34 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
35 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
36 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
37 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
38 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
39 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
40 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
41 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
42 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
43 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
44 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
45 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
46 <citerefentry><refentrytitle>systemd.nspawn</refentrytitle><manvolnum>5</manvolnum></citerefentry>
47 </para></listitem>
48
49 <listitem><para>daemon config files, see
50 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
51 <citerefentry><refentrytitle>systemd-user.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
52 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
53 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
54 <citerefentry><refentrytitle>journal-remote.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
55 <citerefentry><refentrytitle>journal-upload.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
56 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
57 <citerefentry><refentrytitle>timesyncd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
58 </para></listitem>
59 </itemizedlist>
60 </para>
61
62 <para>The syntax is inspired by
63 <ulink url="http://standards.freedesktop.org/desktop-entry-spec/latest/">XDG Desktop Entry Specification</ulink>
64 <filename>.desktop</filename> files, which are in turn inspired by Microsoft Windows
65 <filename>.ini</filename> files.
66 </para>
67
68 <para>Each file is a plain text file divided into sections, with configuration entries in the
69 style <replaceable>key</replaceable>=<replaceable>value</replaceable>.
70 Whitespace immediately before or after the <literal>=</literal> is ignored. Empty lines and lines starting with <literal>#</literal> or <literal>;</literal> are
71 ignored, which may be used for commenting.</para>
72
73 <para>Lines ending in a backslash are concatenated with the following line while reading and the
74 backslash is replaced by a space character. This may be used to wrap long lines. The limit on
75 line length is very large (currently 1 MB), but it is recommended to avoid such long lines and
76 use multiple directives, variable substitution, or other mechanism as appropriate for the given
77 file type. When a comment line or lines follow a line ending with a backslash, the comment block
78 is ignored, so the continued line is concatenated with whatever follows the comment block.</para>
79
80 <example><programlisting>[Section A]
81 KeyOne=value 1
82 KeyTwo=value 2
83
84 # a comment
85
86 [Section B]
87 Setting="something" "some thing" "…"
88 KeyTwo=value 2 \
89 value 2 continued
90
91 [Section C]
92 KeyThree=value 2\
93 # this line is ignored
94 ; this line is ignored too
95 value 2 continued
96 </programlisting></example>
97
98 <para>Boolean arguments used in configuration files can be written in
99 various formats. For positive settings the strings
100 <option>1</option>, <option>yes</option>, <option>true</option>
101 and <option>on</option> are equivalent. For negative settings, the
102 strings <option>0</option>, <option>no</option>,
103 <option>false</option> and <option>off</option> are
104 equivalent.</para>
105
106 <para>Time span values encoded in configuration files can be written in various formats. A stand-alone
107 number specifies a time in seconds. If suffixed with a time unit, the unit is honored. A
108 concatenation of multiple values with units is supported, in which case the values are added
109 up. Example: <literal>50</literal> refers to 50 seconds; <literal>2min 200ms</literal> refers to
110 2 minutes and 200 milliseconds, i.e. 120200 ms. The following time units are understood:
111 <literal>s</literal>, <literal>min</literal>, <literal>h</literal>, <literal>d</literal>,
112 <literal>w</literal>, <literal>ms</literal>, <literal>us</literal>. For details see
113 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
114
115 <para>Various settings are allowed to be specified more than once, in which case the
116 interpretation depends on the setting. Often, multiple settings form a list, and setting to an
117 empty value "resets", which means that previous assignments are ignored. When this is allowed,
118 it is mentioned in the description of the setting. Note that using multiple assignments to the
119 same value makes the file incompatible with parsers for the XDG <filename>.desktop</filename>
120 file format.</para>
121 </refsect1>
122
123 <refsect1>
124 <title>See Also</title>
125 <para>
126 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>
127 </para>
128 </refsect1>
129
130 </refentry>