Jump to content

Autosleep-Script


KWS
 Share

165 posts in this topic

Recommended Posts

yes I do mean the app PleaseSleep.

Vanilla or not, PleaseSleep is free of charge and does its job. U get a nice gui, and with this additional settings I decribed, one has all to set up sleep for his/her needs.

Even some "real" Macs have issues with sleep; therefore the question is not vanilla or not, but if it does the job.

Link to comment
Share on other sites

I'm not knocking the various scripts.. they are helping a lot of ppl. Just wanted to post that for me.. I found that the inability to auto-sleep was due to fakeSMC.. I tried all 3(?) versions I found floating around (2.5, v454, v3.0) and with version 454, I suddenly had auto-sleep again. I can't give an explanation... just relaying what I'm seeing in case it might help someone else. Note: I do not have an internal DVD player (external.. and its always off), but even with SleepEnabler I had lost auto-sleep 2-3 10.6.x updates back.

Link to comment
Share on other sites

yes I do mean the app PleaseSleep.

Vanilla or not, PleaseSleep is free of charge and does its job. U get a nice gui, and with this additional settings I decribed, one has all to set up sleep for his/her needs.

Even some "real" Macs have issues with sleep; therefore the question is not vanilla or not, but if it does the job.

 

Free of charge?:

"If you use PleaseSleep and are happy with it, we would love if you would consider donating."

From your comment i suspect that you are "happy with it". As i wrote my scipt, I had no knowledge of this program. Anyway, i think a "nice gui" isn't necessary for this job ... :glare:

Link to comment
Share on other sites

I did send them a "gift" of 10USD.

And the testing of the "hidden" feature was also my good will.

 

If I like software, I pay for it. Look at my signature; I even "switched" to real macs too.

My guess is that Apple likes Hackintosh, as there r lost of people like me, who first use hack than buy mac.

 

Can you please send the command, that proofs CPU load?

I like your skript, but pleaseSleep (as donation ware) is my favorite :glare:

 

Cheers

Link to comment
Share on other sites

I did send them a "gift" of 10USD.

And the testing of the "hidden" feature was also my good will.

 

If I like software, I pay for it. Look at my signature; I even "switched" to real macs too.

My guess is that Apple likes Hackintosh, as there r lost of people like me, who first use hack than buy mac.

 

Can you please send the command, that proofs CPU load?

I like your skript, but pleaseSleep (as donation ware) is my favorite :P

 

Cheers

So its not yet free of charge? Look, if you want to spend some time, use it for developing your own scripts or apps instead of trolling around ... :(

Link to comment
Share on other sites

Anyway, i think a "nice gui" isn't necessary for this job ... :(

 

Absolutly - I use your RIP3 script - it loads at boot I don't see it, i don't want to see it - and now my system sleeps.

 

Thank you very much :P

Link to comment
Share on other sites

So its not yet free of charge? Look, if you want to spend some time, use it for developing your own scripts or apps instead of trolling around ... :angel:

 

M8,

 

i am in software business, but more in quality assurance. If you ever need some test manager and engineer, you can pm me :)

Link to comment
Share on other sites

  • 2 weeks later...

THX for the new RIP3lanNet Script..exactly what i need :(

 

Besides, it was not Paragon NTFS Driver which stops AutoSleep...ofcourse it was my new LG BH10LS30 BluRay Burner/Combo Drive!

Auto Sleep was working fine "out of the Box" with my old DVD Drive.

 

The Problem is well known that a lot SATA Optical Drives prevent Auto Sleep, on "real" Macs too

 

However, this Script works fine....

Link to comment
Share on other sites

Hi, thanks very much for this little beauty, solved a long term issue I had with timed sleep. Don't suppose you could advise how to add VLC?? (other than sleep resistant) but more like itunes/QT, when it's playing script stops.

 

mh...should be no Problem with VLC ? VLC produce CPU load so the Script wont send SL to sleep

Link to comment
Share on other sites

  • 3 weeks later...
hi KWS,

thanks for the script.

Does it support auto-sleep when battery is low (lower than 2-3% or X% selectable) ? It happens that my computer powers off with low battery and i lose everything.

Mal

Not yet ... :)

Link to comment
Share on other sites

Try this one, it should send your machine to sleep if battery power is less than 3 % (if not charging) ... :)

RIP3lanNetL.app.zip

Apparently there are more problems than expected with shellscripts, so here's a Laptop-Version with almost no shellscript, only one used in battery-monitoring.

However, you must now make use of the screensaver as a trigger, 5 s after screensaver-start the machine will go to sleep.

Sleep is prevented by playing in iTunes, DVD-Player, Quicktime or downloading to the Download-Folder on your home-directory.

Not included is monitoring LAN-Traffic or CPU-usage of Finder and other processes ...

RIPsLAS.app.zip

here the version without battery-monitoring and bigger interval - 5 min from screensaver-start to sleep ...

RIPsAS.app.zip

... and at last one ONLY for battery monitoring (sleep if battery power is less than 3 % (if not charging)

BatteryMon.app.zip

Link to comment
Share on other sites

Try this one, it should send your machine to sleep if battery power is less than 3 %, i havent yet tested it .... ;)

 

Oh thanks! I will try it!

Does it go to sleep if it's under 3% and it's charging ? Or have you included the exception to exclude sleep-on-lowbattery when it's connected to acpower (ie. charging)?

thanks!

Mal

Link to comment
Share on other sites

  • 2 weeks later...

This small prog will show you some values necessary for functioning of RIP3 and save a logfile to your desktop

RIPtest.app.zip

This is a second test, useful if the first went well. Save this prog to your desktop, start it and leave your mouse and keyboard untouched. Every 30 s you should see a dialog box with:

Time till sleep in sec

and

Sec since last input

Its useful to set Time till sleep in Syspref to a small amount. Time since last user input should continually grow (in 30s-steps), if the current value is smaller than the previous one theres some process in the background preventing sleep ...

To stop: Right-click on the prog-icon and select exit ...

RIPtest2.app.zip

Link to comment
Share on other sites

I assume you went to System Prefs -> Users then in the [login items] clicked the [+] at the bottom of the pane and added some version of this? Correct?

 

Then you must logout/login again to activate this (as well as having some short PowerSaver preference - I set mine to 1 minute for sleep).

 

My first attempt was blocked and didn't work. I was wondering why. And I figured out that the permissions for the effective User ID of the auto-sleep daemon must be someone other than my userid. Because it must not be accessing the application. I can't remember if this was in /var/log/system.log or in the Apps -> Utilities -> Console app. But I assumed it couldn't access this because of a directory/file permissioning problem (since I was pointing to the app sitting in my user home directory somewhere which is permissioned restrictively.

 

Solution was to su - root, then cp -pr RIP3*.app /Applications, then chown -R root:wheel.

 

Then include that for each user. But I figured that is brutally inefficient to do this for each user. Better solution is to leveral OS X launchd and figure out a way to globally put this into the system's launcher at startup and so it doesn't matter who's logged in or logged out. It always sleeps. Currently, if no one is logged in on the Hackintosh used by my Kids, the system won't sleep. It works great if they are logged in. I haven't looked at the script enough to see if there are any dependencies. But worth a try. Maybe KWS can weigh in? Is there a reason why we shouldn't put this into the system startup launchd?

 

i'm asking because it didn't work that way.

 

Can someone me help, please?

Link to comment
Share on other sites

2 years ago I made this only for my personal purpose. I am the only user on my hacks and so this problem was not important to me ... from my point of view its ok to put it into the system startup launchd ...

 

After some work on the topic I must unfortunately note that i assume it will not be possible to start THIS (my) script without further modifications by launchd. Right now I'm a little busy in my job, but maybe i work on it in the future ... ;)

Link to comment
Share on other sites

Thanks for the opinion. Been reading up on how launchd works and it looks straightforward. If time permits, I'll give it a go and see if that works out.

 

2 years agobI made this only for my personal purpose. I am the only user on my hacks and so this problem was not important to me ... from my point of view its ok to put it into the system startup launchd ...
Link to comment
Share on other sites

I tried to deploy the RIP3lanNet.app as a LaunchDaemon, but this failed and from the error, I think it was pertaining to no Graphics context when trying to access Application state. I got the feeling that some of the commands in AppleScript are GUI dependent, much like X/Motif/GUI dependencies that prevent some X apps from running if no windowing system is present - baffling because these requests for system service information like application state could simply return non-GUI data and not invoke GUI context.

 

No matter, I wrote a really simple shell script which I named sleepcheck.sh

 

======================================

#!/bin/sh

 

SYSIDLE=`/usr/sbin/ioreg -c IOHIDSystem | /usr/bin/perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle,"\n";last}'| cut -d'.' -f1`

 

SLEEPSETTING=`/usr/bin/pmset -g | /usr/bin/perl -lane 'if(/ sleep/) {print $F[-1]*60; last;}'`

 

#echo "idle time = ${SYSIDLE} seconds"

#echo "sleep setting = ${SLEEPSETTING} seconds"

 

if [ ${SYSIDLE} -ge ${SLEEPSETTING} ]; then

/sbin/shutdown -s now

fi

======================================

 

Then I put this somewhere in my home directory and made it accessible and executable (chmod 755 both the directory I put it in and all parent directories too).

 

Then I su to root and edited the crontab file:

 

% su - root (enter root passwd)

# crontab -e

 

I added one line:

 

*/5 * * * * /Users/gyozadude/bin/sleepcheck.sh >> /dev/null 2>&1

 

(this runs every 5 minutes and executes the sleepcheck and redirects any script output and error output to /dev/null.)

 

It's working now. Thank goodness OS X is UNIX underneath. The hokey thing about Mac OS X is why the heck the regular sleep simply isn't calling "shutdown -s now" equivalent. There should never be the case that we can force sleep by clicking on the "Apple -> sleep" but when we set sysprefs -> user -> powersaver, the sleep doesn't work. Clearly, the implementation is fragile and therefore architecturally questionable. The fact is I can use command line to extract the time remain between HID events and idle time. This data is reliable and easy to get. So something within the launchd or GUI infrastructure is clearly over-complex and therefore incorrectly architected.

Link to comment
Share on other sites

My solution came from the "far" other end. I work as a designer (unfortunately more dtp) and am familiar with Applescripts to shorten production processes.

But a additional problem is to prevent sleep during various circumstances (Network-activity, Quicktime, VLC) , so maybe it is possible to resolve that with a cpu-load query in combination with some in my script used shellscripts ... ?

Link to comment
Share on other sites

My solution came from the "far" other end. I work as a designer (unfortunately more dtp) and am familiar with Applescripts to shorten production processes.

But a additional problem is to prevent sleep during various circumstances (Network-activity, Quicktime, VLC) , so maybe it is possible to resolve that with a cpu-load query in combination with some in my script used shellscripts ... ?

 

 

 

 

PleazeSleep.app

Link to comment
Share on other sites

 Share

×
×
  • Create New...