mirror of
https://git.proxmox.com/git/systemd
synced 2025-06-05 05:39:28 +00:00
91 lines
8.5 KiB
HTML
91 lines
8.5 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>systemd-notify</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
|
||
a.headerlink {
|
||
color: #c60f0f;
|
||
font-size: 0.8em;
|
||
padding: 0 4px 0 4px;
|
||
text-decoration: none;
|
||
visibility: hidden;
|
||
}
|
||
|
||
a.headerlink:hover {
|
||
background-color: #c60f0f;
|
||
color: white;
|
||
}
|
||
|
||
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
|
||
visibility: visible;
|
||
}
|
||
</style><a href="index.html">Index </a>·
|
||
<a href="systemd.directives.html">Directives </a>·
|
||
<a href="../python-systemd/index.html">Python </a>·
|
||
<a href="../libudev/index.html">libudev </a>·
|
||
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 217</span><hr><div class="refentry"><a name="systemd-notify"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>systemd-notify — Notify service manager about start-up completion and other daemon status changes</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">systemd-notify [OPTIONS...] [VARIABLE=VALUE...]</code> </p></div></div><div class="refsect1"><a name="idm214168232032"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><span class="command"><strong>systemd-notify</strong></span> may be
|
||
called by daemon scripts to notify the init system
|
||
about status changes. It can be used to send arbitrary
|
||
information, encoded in an environment-block-like list
|
||
of strings. Most importantly it can be used for
|
||
start-up completion notification.</p><p>This is mostly just a wrapper around
|
||
<code class="function">sd_notify()</code> and makes this
|
||
functionality available to shell scripts. For details
|
||
see
|
||
<a href="sd_notify.html"><span class="citerefentry"><span class="refentrytitle">sd_notify</span>(3)</span></a>.</p><p>The command line may carry a list of
|
||
environment variables to send as part of the status
|
||
update.</p><p>Note that systemd will refuse reception of
|
||
status updates from this command unless
|
||
<code class="varname">NotifyAccess=all</code> is set for the
|
||
service unit this command is called from.</p></div><div class="refsect1"><a name="idm214168226464"></a><h2 id="Options">Options<a class="headerlink" title="Permalink to this headline" href="#Options">¶</a></h2><p>The following options are understood:</p><div class="variablelist"><dl class="variablelist"><dt id="--ready"><span class="term"><code class="option">--ready</code></span><a class="headerlink" title="Permalink to this term" href="#--ready">¶</a></dt><dd><p>Inform the init system
|
||
about service start-up
|
||
completion. This is equivalent to
|
||
<span class="command"><strong>systemd-notify
|
||
READY=1</strong></span>. For details about
|
||
the semantics of this option see
|
||
<a href="sd_notify.html"><span class="citerefentry"><span class="refentrytitle">sd_notify</span>(3)</span></a>.</p></dd><dt id="--pid="><span class="term"><code class="option">--pid=</code></span><a class="headerlink" title="Permalink to this term" href="#--pid=">¶</a></dt><dd><p>Inform the init system
|
||
about the main PID of the
|
||
daemon. Takes a PID as argument. If
|
||
the argument is omitted, the PID of the
|
||
process that invoked
|
||
<span class="command"><strong>systemd-notify</strong></span> is
|
||
used. This is equivalent to
|
||
<span class="command"><strong>systemd-notify
|
||
MAINPID=$PID</strong></span>. For details
|
||
about the semantics of this option see
|
||
<a href="sd_notify.html"><span class="citerefentry"><span class="refentrytitle">sd_notify</span>(3)</span></a>.</p></dd><dt id="--status="><span class="term"><code class="option">--status=</code></span><a class="headerlink" title="Permalink to this term" href="#--status=">¶</a></dt><dd><p>Send a free-form
|
||
status string for the daemon to the
|
||
init systemd. This option takes the
|
||
status string as argument. This is
|
||
equivalent to <span class="command"><strong>systemd-notify
|
||
STATUS=...</strong></span>. For details
|
||
about the semantics of this option see
|
||
<a href="sd_notify.html"><span class="citerefentry"><span class="refentrytitle">sd_notify</span>(3)</span></a>.</p></dd><dt id="--booted"><span class="term"><code class="option">--booted</code></span><a class="headerlink" title="Permalink to this term" href="#--booted">¶</a></dt><dd><p>Returns 0 if the
|
||
system was booted up with systemd,
|
||
non-zero otherwise. If this option is
|
||
passed, no message is sent. This option
|
||
is hence unrelated to the other
|
||
options. For details about the
|
||
semantics of this option, see
|
||
<a href="sd_booted.html"><span class="citerefentry"><span class="refentrytitle">sd_booted</span>(3)</span></a>.</p></dd><dt id="-h"><span class="term"><code class="option">-h</code>, </span><span class="term"><code class="option">--help</code></span><a class="headerlink" title="Permalink to this term" href="#-h">¶</a></dt><dd><p><a name="help-text"></a>Print a short help text and exit.
|
||
</p></dd><dt id="--version"><span class="term"><code class="option">--version</code></span><a class="headerlink" title="Permalink to this term" href="#--version">¶</a></dt><dd><p><a name="version-text"></a>Print a short version string and exit.</p></dd></dl></div></div><div class="refsect1"><a name="idm214172109696"></a><h2 id="Exit status">Exit status<a class="headerlink" title="Permalink to this headline" href="#Exit%20status">¶</a></h2><p>On success, 0 is returned, a non-zero failure
|
||
code otherwise.</p></div><div class="refsect1"><a name="idm214172108512"></a><h2 id="Example">Example<a class="headerlink" title="Permalink to this headline" href="#Example">¶</a></h2><div class="example"><a name="idm214172107840"></a><p class="title"><b>Example 1. Start-up Notification and Status Updates</b></p><div class="example-contents"><p>A simple shell daemon that sends
|
||
start-up notifications after having set up its
|
||
communication channel. During runtime it sends
|
||
further status updates to the init
|
||
system:</p><pre class="programlisting">#!/bin/bash
|
||
|
||
mkfifo /tmp/waldo
|
||
systemd-notify --ready --status="Waiting for data..."
|
||
|
||
while : ; do
|
||
read a < /tmp/waldo
|
||
systemd-notify --status="Processing $a"
|
||
|
||
# Do something with $a ...
|
||
|
||
systemd-notify --status="Waiting for data..."
|
||
done</pre></div></div><br class="example-break"></div><div class="refsect1"><a name="idm214172104832"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
|
||
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
|
||
<a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>,
|
||
<a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>,
|
||
<a href="sd_notify.html"><span class="citerefentry"><span class="refentrytitle">sd_notify</span>(3)</span></a>,
|
||
<a href="sd_booted.html"><span class="citerefentry"><span class="refentrytitle">sd_booted</span>(3)</span></a>
|
||
</p></div></div></body></html>
|