Argh, that should of course be:

--- /usr/bin/unattended-upgrade.orig    2021-06-18 09:46:37.434386824 +0200
+++ /usr/bin/unattended-upgrade 2021-06-18 09:47:03.958639111 +0200
@@ -1353,11 +1353,12 @@
    when = apt_pkg.config.find(
        "Unattended-Upgrade::Automatic-Reboot-Time", "now")
    logging.warning("Found %s, rebooting" % REBOOT_REQUIRED_FILE)
-    cmd = ["/sbin/shutdown", "-r", when]
+    cmd = ["/usr/bin/at", when]
    try:
-        shutdown_msg = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
-        if shutdown_msg.strip():
-            logging.warning("Shutdown msg: %s", shutdown_msg.strip())
+        p = subprocess.Popen(cmd, stdin=subprocess.PIPE, 
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        p_out = p.communicate(input=b'shutdown -r 
now\n')[0].decode('utf-8').strip()
+        if p_out:
+            logging.warning("Shutdown msg: %s", p_out)
    except Exception as e:
        logging.error("Failed to issue shutdown: %s", e)

(s/shutdown -h/shutdown -r/)

As always: feedback appreciated

Thanks & greetings,
*t

Reply via email to