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


Click here to return to the '10.6: Fix sleep problems with SleepWatcher' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Fix sleep problems with SleepWatcher
Authored by: zyuvi00 on Dec 03, '10 04:16:36PM

So I decided to follow through on Andrew's suggestion and create a user-level application (via Automator in my case since I'm not too script savvy). If anyone is interested, here is what I did:

1. Create an Automator "Application"

2. Add a "Run Shell Script" action to the workflow.

3. Paste the following text into the shell script window:
/usr/local/sbin/sleepwatcher -d -S '/usr/local/sbin/sleepwatcher -d -t6000 -i "/usr/local/sbin/sleepwatcher -n" -p /tmp/sleepwatcherid' -W 'kill -9 `cat /tmp/sleepwatcherid`'

4. Replace "6000" with however long you want it to wait. (Value is in 0.1 seconds so 6000 = 10 minutes.)

5. Save the application.

6. Go to "Systems Preferences > Accounts" and add this application to your Login items

Since I'm new to the Mac I was nervous about this doing things like continually launching more and more processes without killing them properly or something like that, so I tested it by setting the sleep time to 10 seconds (-t100) and running it in a bunch of scenarios while watching the Activity Monitor... Seems to work for me.

Thanks for all the pointers in this discussion thread -- helped me work around a frustrating problem with my system crashing every time the OS tried to put my system (with a newly installed SSD) to sleep via the Energy Saver Prefs Pane...



[ Reply to This | # ]
10.6: Fix sleep problems with SleepWatcher
Authored by: agitatedString on Oct 30, '11 12:59:12AM

Hackintoshes? Anyway, getting sleepwatcher to work for me was as simple as putting the following into my ~/.bash_profile file:

result=$(lsof | grep -i sleepwatcher)
if [ -z "$result" ]; then
/opt/local/sbin/sleepwatcher --daemon --sleep /Users/pcs/bin/sleepscript.sh --wakeup /Users/pcs/bin/wakescript.sh
fi



[ Reply to This | # ]