Jump to content

Autosleep-Script


KWS
 Share

165 posts in this topic

Recommended Posts

  • 3 weeks later...

KWS could you please explain whats happening in your "battery check" script here:

 

set batt to do shell script ("ioreg -w0 -l|grep LegacyBatteryInfo")
			set oldDelims to AppleScript's text item delimiters
			set AppleScript's text item delimiters to {"Capacity\"="}
			set all2 to second text item of batt
			set AppleScript's text item delimiters to {","}
			set all to first text item of all2
			set tresh to all / 30 as integer
			set AppleScript's text item delimiters to {"Current\"="}
			set curr2 to second text item of batt
			set AppleScript's text item delimiters to {","}
			set curr to first text item of curr2
			set AppleScript's text item delimiters to oldDelims
			if tresh > curr then

 

I'm trying to understand it and change sleep mode from 3% to 5% and can't work that out.

 

Thanks in advance

s

Link to comment
Share on other sites

in 10.7.2 if i have kwsleep installed, after resuming from sleep the machine waits up to a minute or so (sometimes instantly) and then puts itself back to sleep... anyone else having this issue?

 

+1 here! same exact problem, i don't know if it's related to kwsleep (that i have also installed). This happens only sometimes (maybe when i wake the system by mouse-click and not by power-button but i'm not sure about this).

Bye

Link to comment
Share on other sites

tresh is 100 divided to 30 = 3,33 %-

all is your full battery capacity

You need to change to all divided to 20 = 5 %

 

set tresh to all / 20 as integer

 

Regards

KWS

 

Thanks for clearing that out KWS, I got carried away with this problem and created my own Zarvox-lowBattery voice alert ;)

Best

swavek

Link to comment
Share on other sites

Try as a workaround to execute a keystroke or a mouseclick directly after wake.

Possibly uda dont reset system activity, so after 30 s sleep triggers again ...

 

nope, doesn't seem to do it... mashing the keyboard to no avail, still goes back to sleep.. I've removed kwsleep since and it's fine, just doesn't go to sleep after a certain amount of time.

Link to comment
Share on other sites

QUOTE (Dojomann @ Oct 21 2011, 04:24 AM)

nope, doesn't seem to do it... mashing the keyboard to no avail, still goes back to sleep.. I've removed kwsleep since and it's fine, just doesn't go to sleep after a certain amount of time.

 

OK, in case of sleep-problems i must say that ...

 

iQuit :wacko:

 

I'm very busy at the moment ... maybe I can continue the project sometime in the future ...

 

the future is already gone ... i did a quick workaround to avoid resetting system-activity ... hope it works ...

 

Best Regards

KWS

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Thanks KWS! Your solution worked very well for me, I used it a very long time, beginning with 10.5

A few days ago I updated my machine to 10.7.2 and I was very sad to learn that RIP does not do the job anymore :-(

Anyway, I will find a different solution, I just wanted to express my thankfulness.

 

Best regards

RogerG

Link to comment
Share on other sites

I added updates for 10.7.2 on first page ... :whistle:

 

Great ... working again .. :) on my 10.7.2

 

Questions:

 

i have osx installed on a box as a remote server 10.6.8 using a airport extreme so i can take advantage of the bonjour proxy service.. my problem is that if i access files on the shares of the server... "playing a movie" it will sleep. so i tried to set applefileserver:1 smbd:1 and Applevncserver:1 and it looks that it keeps longer until it sleeps but i can't go smaller than 1. Kwssleep monitors downloading net traffic, maybe the easiest way would be if its possible to monitor the upload too.

 

anyway thx for the update

 

Salu2

Link to comment
Share on other sites

Great ... working again .. :) on my 10.7.2

 

Questions:

 

i have osx installed on a box as a remote server 10.6.8 using a airport extreme so i can take advantage of the bonjour proxy service.. my problem is that if i access files on the shares of the server... "playing a movie" it will sleep. so i tried to set applefileserver:1 smbd:1 and Applevncserver:1 and it looks that it keeps longer until it sleeps but i can't go smaller than 1. Kwssleep monitors downloading net traffic, maybe the easiest way would be if its possible to monitor the upload too.

 

anyway thx for the update

 

Salu2

Maybe you should set a cpu-limit for your movie playing prog ...
Link to comment
Share on other sites

Its the remote one which sleeps, not the one i'm watching on. In other words: i have hack "homeserver" where my media is located. This hack use kws to autosleep. If other pc mac access the server to use the itunes share o run direct an avi from hd share it should stay on but it sleeps. If i make a timemachine backup on that hd share it works perfect.. After backup is done the server sleeps..

 

So if you just read from the server = serve goes into sleep

If you write to the server = server awake

 

Maybe now its clearer

 

Salu2

Link to comment
Share on other sites

kwsleep and RIP are monitoring in- and outgoing traffic (on LAN- and Firewire-Ports, not USB). You can try to open /Library/Scripts/KWS/Sleep.sh with a text editor and change

 

CPUload=30 # Treshold in % for CPU-Load (here 30 = 30% !!)

NetVal=50000 # Treshold for Network-Traffic in Byte/s

 

to - maybe -

 

CPUload=30 # Treshold in % for CPU-Load (here 30 = 30% !!)

NetVal=20000 # Treshold for Network-Traffic in Byte/s

 

so that the treshold for stopping sleep is lower ...

 

Regards

KWS

Link to comment
Share on other sites

I must apologize - KWSleep + KWSleepLion are monitoring only incoming traffic ... :wallbash: ... thanks to OsXsO for the note.

I updated KWSleep and KWSleepLion in first post ... run the full install to detect your network ...

Regards

KWS

Link to comment
Share on other sites

hey KWS

 

thx for the update....... but sorry to say that my machine 10.6.8 isn't sleeping with the updated sleep.sh.

i tried going up to 90000 but no effect...

 

replacing with old sleep.sh working as before

 

any suggestions??

 

 

edit: tried disable the wake op on lan access in system settings, energy saver ... without success

 

edit2: tried on my 10.7.2.. doesn't work

Link to comment
Share on other sites

Excuse me again, you must run the full install to attach your network-ports. Or you start Edit KWSleep and run Network Interfaces - Detect from the menu bar ...

i wrote this script some months ago ... :whistle:

Regards

KWS

Link to comment
Share on other sites

So I am at my wits end - here the script stops if in- or outgoing traffic greater than 50 kbyte/s occurs.

Are you sure that the network-port with your outgoing traffic (shown in system settings - Network (standard is en0) is detected by the script...

 

Regards

KWS

Link to comment
Share on other sites

 Share

×
×
  • Create New...