systemctl: don't warn unit needs reload if --no-warn
authorMike Yuan <me@yhndnzj.com>
Wed, 14 Feb 2024 13:19:21 +0000 (21:19 +0800)
committerMike Yuan <me@yhndnzj.com>
Wed, 14 Feb 2024 16:37:19 +0000 (00:37 +0800)
man/systemctl.xml
src/systemctl/systemctl-util.c

index 4a84df343b7d826cb23dbc26cb786110d643d733..98844783b01c1db4f82bbc156da3337d661fbf36 100644 (file)
@@ -2289,7 +2289,10 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
             </listitem>
             <listitem>
               <para>when a <command>stop</command>-ped, <command>disable</command>-d, or <command>mask</command>-ed
-              unit still has active triggering units.</para>
+              unit still has active triggering units,</para>
+            </listitem>
+            <listitem>
+              <para>when a unit file is changed and requires <command>daemon-reload</command>.</para>
             </listitem>
           </itemizedlist>
           </para>
index f37401d917c1779cb915d2ed8dbbba7fda439309..de6f53aafe64a789fde630ca1c4c8b90b049860d 100644 (file)
@@ -434,6 +434,9 @@ int need_daemon_reload(sd_bus *bus, const char *unit) {
 void warn_unit_file_changed(const char *unit) {
         assert(unit);
 
+        if (arg_no_warn)
+                return;
+
         log_warning("Warning: The unit file, source configuration file or drop-ins of %s changed on disk. Run 'systemctl%s daemon-reload' to reload units.",
                     unit,
                     arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "" : " --user");