]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-notify.xml
man: revert dynamic paths for split-usr setups
[thirdparty/systemd.git] / man / systemd-notify.xml
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
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
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
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="systemd-notify"
25 xmlns:xi="http://www.w3.org/2001/XInclude">
26
27 <refentryinfo>
28 <title>systemd-notify</title>
29 <productname>systemd</productname>
30
31 <authorgroup>
32 <author>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
37 </author>
38 </authorgroup>
39 </refentryinfo>
40
41 <refmeta>
42 <refentrytitle>systemd-notify</refentrytitle>
43 <manvolnum>1</manvolnum>
44 </refmeta>
45
46 <refnamediv>
47 <refname>systemd-notify</refname>
48 <refpurpose>Notify service manager about start-up completion and other daemon status changes</refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <cmdsynopsis>
53 <command>systemd-notify <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt" rep="repeat">VARIABLE=VALUE</arg></command>
54 </cmdsynopsis>
55 </refsynopsisdiv>
56
57 <refsect1>
58 <title>Description</title>
59
60 <para><command>systemd-notify</command> may be called by daemon
61 scripts to notify the init system about status changes. It can be
62 used to send arbitrary information, encoded in an
63 environment-block-like list of strings. Most importantly it can be
64 used for start-up completion notification.</para>
65
66 <para>This is mostly just a wrapper around
67 <function>sd_notify()</function> and makes this functionality
68 available to shell scripts. For details see
69 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
70 </para>
71
72 <para>The command line may carry a list of environment variables
73 to send as part of the status update.</para>
74
75 <para>Note that systemd will refuse reception of status updates
76 from this command unless <varname>NotifyAccess=all</varname> is
77 set for the service unit this command is called from.</para>
78
79 </refsect1>
80
81 <refsect1>
82 <title>Options</title>
83
84 <para>The following options are understood:</para>
85
86 <variablelist>
87 <varlistentry>
88 <term><option>--ready</option></term>
89
90 <listitem><para>Inform the init system about service start-up
91 completion. This is equivalent to <command>systemd-notify
92 READY=1</command>. For details about the semantics of this
93 option see
94 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
95 </varlistentry>
96
97 <varlistentry>
98 <term><option>--pid=</option></term>
99
100 <listitem><para>Inform the init system about the main PID of
101 the daemon. Takes a PID as argument. If the argument is
102 omitted, the PID of the process that invoked
103 <command>systemd-notify</command> is used. This is equivalent
104 to <command>systemd-notify MAINPID=$PID</command>. For details
105 about the semantics of this option see
106 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
107 </varlistentry>
108
109 <varlistentry>
110 <term><option>--status=</option></term>
111
112 <listitem><para>Send a free-form status string for the daemon
113 to the init systemd. This option takes the status string as
114 argument. This is equivalent to <command>systemd-notify
115 STATUS=...</command>. For details about the semantics of this
116 option see
117 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
118 </varlistentry>
119
120 <varlistentry>
121 <term><option>--booted</option></term>
122
123 <listitem><para>Returns 0 if the system was booted up with
124 systemd, non-zero otherwise. If this option is passed, no
125 message is sent. This option is hence unrelated to the other
126 options. For details about the semantics of this option, see
127 <citerefentry><refentrytitle>sd_booted</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
128 </varlistentry>
129
130 <xi:include href="standard-options.xml" xpointer="help" />
131 <xi:include href="standard-options.xml" xpointer="version" />
132 </variablelist>
133
134 </refsect1>
135
136 <refsect1>
137 <title>Exit status</title>
138
139 <para>On success, 0 is returned, a non-zero failure code
140 otherwise.</para>
141 </refsect1>
142
143 <refsect1>
144 <title>Example</title>
145
146 <example>
147 <title>Start-up Notification and Status Updates</title>
148
149 <para>A simple shell daemon that sends start-up notifications
150 after having set up its communication channel. During runtime it
151 sends further status updates to the init system:</para>
152
153 <programlisting>#!/bin/bash
154
155 mkfifo /tmp/waldo
156 systemd-notify --ready --status="Waiting for data..."
157
158 while : ; do
159 read a &lt; /tmp/waldo
160 systemd-notify --status="Processing $a"
161
162 # Do something with $a ...
163
164 systemd-notify --status="Waiting for data..."
165 done</programlisting>
166 </example>
167 </refsect1>
168
169 <refsect1>
170 <title>See Also</title>
171 <para>
172 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
173 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
174 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
175 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
176 <citerefentry><refentrytitle>sd_booted</refentrytitle><manvolnum>3</manvolnum></citerefentry>
177 </para>
178 </refsect1>
179
180 </refentry>