Jump to content

sleep watcher


ytrox
 Share

7 posts in this topic

Recommended Posts

I'm using sleepwatcher to work around three issues:

 

- Autosleep doesn't work here. sleepwatcher takes care of that and puts the computer to sleep X minutes after the display went to sleep.

- Since some external USB drives aren't properly put to sleep, I tell sleepwatcher to unmount them prior to sleep and mount them again at wakeup.

- As Lion does have some problems reconnecting to my WiFi network, sleepwatcher disables my WiFi card at sleep and enables it at wakeup.

 

Very handy!

Link to comment
Share on other sites

I'm using sleepwatcher to work around three issues:

 

- Autosleep doesn't work here. sleepwatcher takes care of that and puts the computer to sleep X minutes after the display went to sleep.

- Since some external USB drives aren't properly put to sleep, I tell sleepwatcher to unmount them prior to sleep and mount them again at wakeup.

- As Lion does have some problems reconnecting to my WiFi network, sleepwatcher disables my WiFi card at sleep and enables it at wakeup.

 

Very handy!

 

Would you mind posting your scripts for these actions? I have issues with USB after waking from sleep and it sounds like you already have a script that would solve the problem. Thanks.

Link to comment
Share on other sites

Would you mind posting your scripts for these actions? I have issues with USB after waking from sleep and it sounds like you already have a script that would solve the problem. Thanks.

Put the following into your .sleep script located in your home folder to eject a drive called "STICK" right before sleep. The last line delays the sleep for an additional second just to be sure.

if [ -d /Volumes/STICK ]
then
 /usr/sbin/diskutil unmount /Volumes/STICK
fi
osascript -e 'tell application "Finder" to delay 1'

Put the following into your .wakeup script in your home folder to remount the drive called "STICK" again at wakeup.

/usr/sbin/diskutil mount STICK

 

If you need elevated root privileges for your actions edit rc.sleep and rc.wakeup located in /usr/local/etc/sleepwatcher/ instead. To disable wifi add the following at the end of /usr/local/etc/sleepwatcher/rc.sleep

ifconfig en1 down

and to re-enable it again add the following at the end of /usr/local/etc/sleepwatcher/rc.wakeup

ifconfig en1 up

Link to comment
Share on other sites

  • 1 month later...

Hi,

this is a very interesting thread.

I will certainly use this to eject drives. (Unless someone knows a DSDT fix for USB wake problems on gigabyte sandy bridge???)

 

I have a question though,

do you think a command could be used to sleep&wake the usb mouse/keyboard?

that would make this a complete workaround solution!!

 

thanks

Link to comment
Share on other sites

 Share

×
×
  • Create New...