]>
Commit | Line | Data |
---|---|---|
c5abba08 LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
4 | ||
5 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2010 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
11 | under the terms of the GNU Lesser General Public License as published by |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
c5abba08 LP |
13 | (at your option) any later version. |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 18 | Lesser General Public License for more details. |
c5abba08 | 19 | |
5430f7f2 | 20 | You should have received a copy of the GNU Lesser General Public License |
c5abba08 LP |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
22 | --> | |
23 | ||
24 | <refentry id="systemd-notify"> | |
25 | ||
26 | <refentryinfo> | |
27 | <title>systemd-notify</title> | |
28 | <productname>systemd</productname> | |
29 | ||
30 | <authorgroup> | |
31 | <author> | |
32 | <contrib>Developer</contrib> | |
33 | <firstname>Lennart</firstname> | |
34 | <surname>Poettering</surname> | |
35 | <email>lennart@poettering.net</email> | |
36 | </author> | |
37 | </authorgroup> | |
38 | </refentryinfo> | |
39 | ||
40 | <refmeta> | |
41 | <refentrytitle>systemd-notify</refentrytitle> | |
42 | <manvolnum>1</manvolnum> | |
43 | </refmeta> | |
44 | ||
45 | <refnamediv> | |
46 | <refname>systemd-notify</refname> | |
34511ca7 | 47 | <refpurpose>Notify service manager about start-up completion and other daemon status changes</refpurpose> |
c5abba08 LP |
48 | </refnamediv> |
49 | ||
50 | <refsynopsisdiv> | |
51 | <cmdsynopsis> | |
52 | <command>systemd-notify <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt" rep="repeat">VARIABLE=VALUE</arg></command> | |
53 | </cmdsynopsis> | |
54 | </refsynopsisdiv> | |
55 | ||
56 | <refsect1> | |
57 | <title>Description</title> | |
58 | ||
59 | <para><command>systemd-notify</command> may be | |
60 | called by daemon scripts to notify the init system | |
61 | about status changes. It can be used to send arbitrary | |
62 | information, encoded in an environment-block-like list | |
63 | of strings. Most importantly it can be used for | |
64 | start-up completion notification.</para> | |
65 | ||
66 | <para>This is mostly just a wrapper around | |
67 | <function>sd_notify()</function> and makes this | |
68 | functionality available to shell scripts. For details | |
69 | see | |
70 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> | |
71 | ||
72 | <para>The command line may carry a list of | |
73 | environment variables to send as part of the status | |
74 | update.</para> | |
75 | ||
c61fbdfc LP |
76 | <para>Note that systemd will refuse reception of |
77 | status updates from this command unless | |
78 | <varname>NotifyAccess=all</varname> is set for the | |
79 | service unit this command is called from.</para> | |
80 | ||
c5abba08 LP |
81 | </refsect1> |
82 | ||
83 | <refsect1> | |
84 | <title>Options</title> | |
85 | ||
86 | <para>The following options are understood:</para> | |
87 | ||
88 | <variablelist> | |
89 | <varlistentry> | |
a45ad38b | 90 | <term><option>-h</option></term> |
c5abba08 LP |
91 | <term><option>--help</option></term> |
92 | ||
93 | <listitem><para>Prints a short help | |
94 | text and exits.</para></listitem> | |
95 | </varlistentry> | |
96 | ||
9aac0b2c LP |
97 | <varlistentry> |
98 | <term><option>--version</option></term> | |
99 | ||
100 | <listitem><para>Prints a short version | |
101 | string and exits.</para></listitem> | |
102 | </varlistentry> | |
103 | ||
c5abba08 LP |
104 | <varlistentry> |
105 | <term><option>--ready</option></term> | |
106 | ||
107 | <listitem><para>Inform the init system | |
108 | about service start-up | |
109 | completion. This is equivalent to | |
110 | <command>systemd-notify | |
111 | READY=1</command>. For details about | |
112 | the semantics of this option see | |
113 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem> | |
114 | </varlistentry> | |
115 | ||
116 | <varlistentry> | |
117 | <term><option>--pid=</option></term> | |
118 | ||
119 | <listitem><para>Inform the init system | |
120 | about the main PID of the | |
121 | daemon. Takes a PID as argument. If | |
122 | the argument is omitted the PID of the | |
123 | process that invoked | |
124 | <command>systemd-notify</command> is | |
125 | used. This is equivalent to | |
126 | <command>systemd-notify | |
127 | MAINPID=$PID</command>. For details | |
128 | about the semantics of this option see | |
129 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem> | |
130 | </varlistentry> | |
131 | ||
132 | <varlistentry> | |
133 | <term><option>--status=</option></term> | |
134 | ||
135 | <listitem><para>Send a free-form | |
136 | status string for the daemon to the | |
137 | init systemd. This option takes the | |
138 | status string as argument. This is | |
139 | equivalent to <command>systemd-notify | |
140 | STATUS=...</command>. For details | |
141 | about the semantics of this option see | |
142 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem> | |
143 | </varlistentry> | |
144 | ||
145 | <varlistentry> | |
146 | <term><option>--booted</option></term> | |
147 | ||
148 | <listitem><para>Returns 0 if the | |
149 | system was booted up with systemd, | |
150 | non-zero otherwise. If this option is | |
151 | passed no message is sent. This option | |
152 | is hence unrelated to the other | |
153 | options. For details about the | |
154 | semantics of this option see | |
155 | <citerefentry><refentrytitle>sd_booted</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem> | |
156 | </varlistentry> | |
6624768c LP |
157 | |
158 | <varlistentry> | |
159 | <term><option>--readahead=</option></term> | |
160 | ||
161 | <listitem><para>Controls disk | |
162 | read-ahead operations. The argument | |
163 | must be a string, and either "cancel", | |
164 | "done" or "noreplay". For details | |
165 | about the semantics of this option see | |
166 | <citerefentry><refentrytitle>sd_readahead</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem> | |
167 | </varlistentry> | |
c5abba08 LP |
168 | </variablelist> |
169 | ||
170 | </refsect1> | |
171 | ||
172 | <refsect1> | |
173 | <title>Exit status</title> | |
174 | ||
175 | <para>On success 0 is returned, a non-zero failure | |
176 | code otherwise.</para> | |
177 | </refsect1> | |
178 | ||
c61fbdfc LP |
179 | <refsect1> |
180 | <title>Example</title> | |
181 | ||
182 | <example> | |
183 | <title>Start-up Notification and Status Updates</title> | |
184 | ||
185 | <para>A simple shell daemon that sends | |
186 | start-up notifications after having set up its | |
187 | communication channel. During runtime it sends | |
188 | further status updates to the init | |
189 | system:</para> | |
190 | ||
191 | <programlisting>#!/bin/bash | |
192 | ||
193 | mkfifo /tmp/waldo | |
194 | systemd-notify --ready --status="Waiting for data..." | |
195 | ||
196 | while : ; do | |
197 | read a < /tmp/waldo | |
198 | systemd-notify --status="Processing $a" | |
199 | ||
200 | # Do something with $a ... | |
201 | ||
202 | systemd-notify --status="Waiting for data..." | |
203 | done</programlisting> | |
204 | </example> | |
205 | </refsect1> | |
206 | ||
c5abba08 LP |
207 | <refsect1> |
208 | <title>See Also</title> | |
209 | <para> | |
210 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
211 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
212 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
213 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
214 | <citerefentry><refentrytitle>sd_booted</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
215 | </para> | |
216 | </refsect1> | |
217 | ||
218 | </refentry> |