MacOS – Set timeout when falling asleep before network disconnects

macbook promacosNetworksleep-wake

I'm using OS X Mavericks (latest) on a 15″ 2014 MBP. There's an option to make the system not lock the screen for x number of seconds/minutes after the screen goes dim. I'm looking for an option to not disconnect the network for x number of seconds/minutes after the screen dims.

Here's the situation (happens a couple times a day): I'm VPN'd in somewhere and have a bunch of SSH and RDP sessions open. I then have to go sit in a meeting where I'd be busy talking to someone or looking at a presentation. I try to keep my screen awake but sometimes I catch it a bit late, often right as it's just going totally dark. When that happens I move the mouse and it wakes up and doesn't ask for a password (since it's only been a few seconds) but my VPN has disconnected and all of my SSH and RDP sessions are killed.

Is there any way to set a grace period for when the network goes down the way you can set a grace period for when the system is locked?

Best Answer

Yes, you'll use an app like Caffeine and use it's timer or script a watcher to remove Caffeine's power assertion after the time you specify.

You can use the command line peset -g assertionslog to watch the progress of the machine into and away from sleep. You might even be able to use pmset to hard code the behavior you wish after reading the manual page a few times and experimenting with the debug logs it provides.