Accidental shutdown or reboot is a serious blunder, especially if the kernel is being updated in the background.

I recommend you to use systemd-inhibit to prevent Linux from shutting down while your important cron jobs are running (e.g. operating system update scripts):

systemd-inhibit --why="Doing update" ./my-update-script.sh

systemd-inhibit will block the shutdown or reboot until the update script is finished.

Additional options:

  • –who= »your name »
    A human-readable name
  • list
    List all active inhibition locks