systemctl-start: suppress the triggering unit warning when --no-warn

This commit is contained in:
Mike Yuan 2023-09-26 23:01:52 +08:00
parent 002db03f54
commit 0b675f97d6
No known key found for this signature in database
GPG key ID: 417471C0A40F58B3
2 changed files with 9 additions and 2 deletions

View file

@ -443,6 +443,10 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
It will <emphasis>not</emphasis> fail if any of the commands configured to stop the unit
(<varname>ExecStop=</varname>, etc.) fail, because the manager will still forcibly terminate the
unit.</para>
<para>If a unit that gets stopped can still be triggered by other units, a warning containing
the names of the triggering units is shown. <option>--no-warn</option> can be used to suppress
the warning.</para>
</listitem>
</varlistentry>
<varlistentry>
@ -2233,7 +2237,10 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
</listitem>
<listitem>
<para>when using <command>disable</command> combined with <option>--user</option> on units
that are enabled in global scope.</para>
that are enabled in global scope,</para>
</listitem>
<listitem>
<para>when a <command>stop</command>-ped unit still has active triggering units.</para>
</listitem>
</itemizedlist>
</para>

View file

@ -392,7 +392,7 @@ int verb_start(int argc, char *argv[], void *userdata) {
/* When stopping units, warn if they can still be triggered by
* another active unit (socket, path, timer) */
if (!arg_quiet)
if (!arg_quiet && !arg_no_warn)
STRV_FOREACH(unit, stopped_units)
warn_triggering_units(bus, *unit, "Stopping", /* ignore_masked = */ true);
}