I use Ubuntu 22.04.4 LTS (Default settings) (GNOME) on a NUC. I want to restart that machine within 5 seconds. However if a file, config or similar thing is still open the restart or shutdown triggers a confirmation prompt that requires me to wait 60 sec.
The background is: I work in a lab setting. We have an NUC without casing. I need that restart/shutdown within 5 seconds since the NUC and the monitor/keyboard are in separate rooms, so the person triggering the shutdown can't see the screen nor confirm the entry. If somebody left a config file open the NUC will not shut down in time and is in danger of damage (since the person shutting it down will most likely touch it).
I already check the internet, including this question from 13 years ago but I can not find a solution for Ubuntu 22. The given answer works for Ubuntu 12, but I can confirm that it does not work for 22.04.4.
Altering DefaultTimeoutStopSec
in /etc/systemd/system.conf
has seemingly no effect.