Jump to content
  • Announcements

    • Allan

      Forum Rules   04/13/2018

      Hello folks! As some things are being fixed, we'll keep you updated. Per hour the Forum Rules don't have a dedicated "Tab", so here is the place that we have our Rules back. New Users Lounge > [READ] - InsanelyMac Forum Rules - The InsanelyMac Staff Team. 
nofearl

Shutdown on low battery

10 posts in this topic

Recommended Posts

a quick script that checks the battery level every 2mins and shutdowns the computer if its less than 3%

 

copy batterysave to /bin

copy plist file to /System/Library/LaunchDaemons/

 

run

 

sudo su -
chmod +x /bin/batterysave
chown root:wheel /System/Library/LaunchDaemons/com.nofearl.batterysave.plist

 

and restart...

 

it uses "shutdown -h now" and its not graceful (you will loose unsaved document)

 

but since the sleep is not working for me, better than depleting and possibly damaging the battery..

 

batterysave.zip

Share this post


Link to post
Share on other sites

 

hi guyz,

thanks for the script and for the link!

 

I have 2 questions about this topic:

 

1) is it possible to change the batterysave script to force it to go to "sleep" instead of shutdown? How could it be done? I can't find any hibernate or sleep command like shutdown... I ask because in my system, although sleep works, it doesn't go automatically in sleep when battery is low (i don't know where is the preference to control/adjust that ... if anyone knows it, please let me know because it's what i am looking for now... thanks -_- )

 

2) I know there is smartsleep that should do that, but in my system it doesn't work. The question is : Is it possible to "force" SmartSleep to use hibernatemode 5 instead of 1 for hibernating ? it uses hibernatemode 1 by default and with this mode hibernatemode here doesn't work (also unchecking secure virtual memory under preferences-security). Here mode5 works, mode1 not and that's the reason why i am asking... the smartmode is the option i am looking for, if i just can replace hibernatemode=5,instead of hibernatemode=1 set by default by smartmode in smartsleep.

 

Thanks in advance!

Mal

Share this post


Link to post
Share on other sites
is it possible to change the batterysave script to force it to go to "sleep" instead of shutdown? How could it be done? I can't find any hibernate or sleep command like shutdown... I ask because in my system, although sleep works, it doesn't go automatically in sleep when battery is low (i don't know where is the preference to control/adjust that ... if anyone knows it, please let me know because it's what i am looking for now... thanks ;) )

Sure it could be done. Here is an effort to make it sleep instead of shutdown. It is untested though.

batterysleep.zipAlso, use this next one if u 'd like to make your machine go to hibernate instead, while preserving on-demand sleep mode.

batteryhibernate.zip

Greetz

Share this post


Link to post
Share on other sites
Sure it could be done. Here is an effort to make it sleep instead of shutdown. It is untested though.

batterysleep.zipAlso, use this next one if u 'd like to make your machine go to hibernate instead, while preserving on-demand sleep mode.

batteryhibernate.zip

Greetz

 

hello i am about to try ur script. But i got a question which you set hibernation mode to 1 in the beginning and return to mode 3 when executing the script. Is it necessary to change mode from 1 to 3? since my hibernation mode is 3.

Edit: I v tried the Script for Hibernation. The script executed well however it did not send machine to Hibernation but to Sleep.

 

Finally i got the last thing that my laptop should work like mac. My Laptop hibernate when battery is low. sleeps like usual. I achieved via Ur script and App Smartsleep

Thanks

Share this post


Link to post
Share on other sites
Sure it could be done. Here is an effort to make it sleep instead of shutdown. It is untested though.

batterysleep.zipAlso, use this next one if u 'd like to make your machine go to hibernate instead, while preserving on-demand sleep mode.

batteryhibernate.zip

Greetz

 

 

The sleep mode works pretty well on mine ASUS 1201n, thank you very much!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×