|
54 | 54 | off the process, i.e. on all processes that match <varname>NotifyAccess=</varname><option>main</option> or
|
55 | 55 | <varname>NotifyAccess=</varname><option>exec</option>. Conversely, if an auxiliary process of the unit sends an
|
56 | 56 | <function>sd_notify()</function> message and immediately exits, the service manager might not be able to properly
|
57 |
| - attribute the message to the unit, and thus will ignore it, even if |
58 |
| - <varname>NotifyAccess=</varname><option>all</option> is set for it.</para> |
59 |
| - |
60 |
| - <para><command>systemd-notify</command> will first attempt to invoke <function>sd_notify()</function> pretending to |
61 |
| - have the PID of the invoking process. This will only succeed when invoked with sufficient privileges. On failure, |
62 |
| - it will then fall back to invoking it under its own PID. This behaviour is useful in order that when the tool is |
63 |
| - invoked from a shell script the shell process — and not the <command>systemd-notify</command> process — appears as |
64 |
| - sender of the message, which in turn is helpful if the shell process is the main process of a service, due to the |
65 |
| - limitations of <varname>NotifyAccess=</varname><option>all</option> described above.</para> |
| 57 | + attribute the message to the unit, and thus will ignore it, even if <varname>NotifyAccess=</varname><option>all |
| 58 | + </option> is set for it. When <option>--no-block</option> is used, all synchronization for reception of notifications |
| 59 | + is disabled, and hence the aforementioned race may occur if the invoking process is not the service manager or spawned |
| 60 | + by the service manager.</para> |
| 61 | + |
| 62 | + <para>Hence, <command>systemd-notify</command> will first attempt to invoke <function>sd_notify()</function> |
| 63 | + pretending to have the PID of the invoking process. This will only succeed when invoked with sufficient privileges. |
| 64 | + On failure, it will then fall back to invoking it under its own PID. This behaviour is useful in order that when |
| 65 | + the tool is invoked from a shell script the shell process — and not the <command>systemd-notify</command> process |
| 66 | + — appears as sender of the message, which in turn is helpful if the shell process is the main process of a service, |
| 67 | + due to the limitations of <varname>NotifyAccess=</varname><option>all</option>. Use the <option>--pid=</option> |
| 68 | + switch to tweak this behaviour.</para> |
| 69 | + |
66 | 70 | </refsect1>
|
67 | 71 |
|
68 | 72 | <refsect1>
|
|
129 | 133 | with systemd. </para></listitem>
|
130 | 134 | </varlistentry>
|
131 | 135 |
|
| 136 | + <varlistentry> |
| 137 | + <term><option>--no-block</option></term> |
| 138 | + |
| 139 | + <listitem><para>Do not synchronously wait for the requested operation to finish. |
| 140 | + Use of this option is only recommended when <command>systemd-notify</command> |
| 141 | + is spawned by the service manager, or when the invoking process is directly spawned |
| 142 | + by the service manager and has enough privileges to allow <command>systemd-notify |
| 143 | + </command> to send the notification on its behalf. Sending notifications with |
| 144 | + this option set is prone to race conditions in all other cases.</para></listitem> |
| 145 | + </varlistentry> |
| 146 | + |
132 | 147 | <xi:include href="standard-options.xml" xpointer="help" />
|
133 | 148 | <xi:include href="standard-options.xml" xpointer="version" />
|
134 | 149 | </variablelist>
|
|
0 commit comments