Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Use Safe Sleep and Fast User Switching via script System
I have the last revision PowerBook, which has the hibernate mode option (Safe Sleep), and I started to use Safe Sleep in place of simple sleep since I first found this helper script here on macosxhints.com

The problem is that I get kernel panics randomly when my PowerBook comes back to life, and don't know why. So I decided to modify the script. Another motivation is that I wanted to switch back to the login window in order to have a simple way to lock my computer. And I discovered a way to do just that. The trick here is to use CGSession to suspend the current user account using the Fast User switching option.

So here's an AppleScript that just does both things: first, switches to the login window, and then enters Safe Sleep mode. You can attach this code to any launcher, macros, combo keys as usual. Please note that my script has no way to set the hibernatemode back to normal, so if you use this, don't forget to get back to normal sleep with the command pmset -a hibernatemode 3.
    •    
  • Currently 1.67 / 5
  You rated: 2 / 5 (3 votes cast)
 
[11,305 views]  

10.4: Use Safe Sleep and Fast User Switching via script | 6 comments | Create New Account
Click here to return to the '10.4: Use Safe Sleep and Fast User Switching via script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fast User Switching via script
Authored by: hayne on Nov 20, '06 09:18:54AM
The CGSession trick for doing fast-user-switching was the subject of this macosxhints article:
http://www.macosxhints.com/article.php?story=20031102031045417

[ Reply to This | # ]
10.4: Use Safe Sleep and Fast User Switching via script
Authored by: clknight on Nov 20, '06 09:33:46AM

Out of curiosity, do you have a 3rd party hard drive? My WD scorpio (purchased from OWC) causes kernel panics when you trigger the sudden motion sensor--some sort of conflict with the drive's internal shock protection mechanism. These almost always showed up when I put it to sleep because I would move the computer while SafeSleep was still writing RAM to disk, and it would trigger the SMS.

Solution in this case was to disable SMS and rely on the drive's internal protection.

---
Chris



[ Reply to This | # ]
10.4: Use Safe Sleep and Fast User Switching via script
Authored by: metiure on Nov 20, '06 02:12:58PM

to clknight: no, I have the PB original internal HD.

Anyway, as I have a 2 partitions HD, I suspect my kernel panics when back from safesleep have to do with the second partition not mounting. Not sure, though, and I have no external HD right now to test it.



[ Reply to This | # ]
10.4: Use Safe Sleep and Fast User Switching via script
Authored by: Anonymous on Nov 21, '06 05:35:07AM

Before I try this - does this work on Intel Macs? With the PMset it makes me wonder.... If not, does anyone know a way to script this? It's too bad apple doesn't add "Deep Sleep" or something akin to that in their apple menu next to the other sleep/shutdown/restart commands.



[ Reply to This | # ]
Works with Leopard
Authored by: Neville Hillyer on Jul 21, '09 10:18:23AM

I have been looking for a way to do this with Leopard.

The script worked first time without modification.



[ Reply to This | # ]
10.4: Use Safe Sleep and Fast User Switching via script
Authored by: excarnate on Jul 22, '09 08:21:02AM

I got a kernel panic on waking from Safe Sleep (hibernation) with my iMac 2.16 GHz Core 2 Duo running Mac OS X 10.4.11 but checking the logs pointed the finger at the Logitech Control Center (LCC). I had the latest at the time, LCC 2.7

Removing the Logitech software (and restarting) cured the problem with panics and now my Macintosh can safe sleep without problems.



[ Reply to This | # ]