Skip to main content
Question

Log off the current user upon closing the lid

  • September 28, 2017
  • 3 replies
  • 29 views

Forum|alt.badge.img+2

Hi,

Is there anyway to set the OS to log off the user when the lid is closed on Sierra?

What I'm trying to accomplish is to run a script from JSS which triggers at the log off, however, 99% of the time users don't log off and just close the lid.

Any help is much appreciated.

Thank you in advance.

3 replies

Forum|alt.badge.img+16
  • Valued Contributor
  • September 28, 2017

You might want to be careful altering lid closure behaviour, it's generally set to sleep/hibernate the machine immediately and people usually follow this up by immediately putting it in a bag or other thermally enclosed space. The few times my machine has woken or not gone to sleep properly in my bag it has got so hot it's not a process I would want to repeat often!


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • September 29, 2017

@javidmajdi Rather than try to run a script from your JSS, you'd be better off with a script you've installed locally on the user's machine that checks for the lid being closed with a user logged in, and are triggering periodically via a LaunchDaemon. See this article on StackExchange for some ideas:

https://apple.stackexchange.com/questions/104486/macbook-air-pro-run-script-upon-lid-close


Forum|alt.badge.img+8
  • Valued Contributor
  • January 25, 2019

@javidmajdi Did you find a solution you liked for triggering a script when the lid closes? I have the same problem in my school. Kids close the lid instead of log off, and even those that do, never bother to click ok in the warning screen.