Skip to main content
1 of 3

How to shutdown pc if no user is logged in?

I am sorry if I have missed any existing answers or solutions - my searching did not bring up any solutions yet.

The issue:

My pc contains Windows and Linux, with Linux being the primary OS. Windows is used occasionally and has got the tendency of doing a reboot upon shutdown, to install some updates and then really shutdown. However, as Linux is the primary boot target, this reboot-then-shutdown will boot into Linux, where it will sit at the logon indefinitely. I want it to time out after 5 or 10 minutes of no login and shutdown.

The solutions / attempts:

I have come across setting a timeout in /etc/systemd/login.conf

IdleAction=poweroff IdleActionSec=10min 

However, this kills my session after 10 minutes even if I am actively typing.

Thank you for any hints or recommendations.