Skip to main content
2 of 9
added 262 characters in body
gapsf
  • 624
  • 4
  • 7

This unit runs shutdown-no-user-sessions.service after 15min from boot

/etc/systemd/system/is-active-user-sessions.timer [Unit] Description=Start check if there is actvie user sessions [Timer] OnBootSec=15min Unit=shutdown-no-user-sessions [Install] WantedBy=timers.target 

This unit starts your script to check logged users

/etc/systemd/system/shutdown-no-user-sessions.service [Unit] Description=Shutdown if no actvie session [Service] Type=oneshot ExecStart=script_to_check_user_logins 

In script you parse output of loginctl --no-pager list-users and shutdown if there is no user sessions.

gapsf
  • 624
  • 4
  • 7