chiark / gitweb /
Add dry_run support to manager_scheduled_shutdown_handler()
authorSven Eden <yamakuzure@gmx.net>
Wed, 13 Jun 2018 05:58:05 +0000 (07:58 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 29 Jun 2018 05:12:51 +0000 (07:12 +0200)
src/login/elogind-dbus.c

index baa36b1f28c474d65bb322b24497dceed0cd6b61..2bb8228f12180d25cc946fd1820981a34b1f2747 100644 (file)
@@ -442,6 +442,19 @@ int manager_scheduled_shutdown_handler(
                 return -EALREADY;
         }
 
+        if (m->shutdown_dry_run) {
+                /* We do not process delay inhibitors here.  Otherwise, we
+                 * would have to be considered "in progress" (like the check
+                 * above) for some seconds after our admin has seen the final
+                 * wall message. */
+
+                bus_manager_log_shutdown(m, target);
+                log_info("Running in dry run, suppressing action.");
+                reset_scheduled_shutdown(m);
+
+                return 0;
+        }
+
         r = execute_shutdown_or_sleep(m, 0, action, &error);
         if (r < 0)
                 return log_error_errno(r, "Scheduled shutdown to %s failed: %m",