Looking for a Mac program (or some other way) that will monitor my MacBook's battery and turn off another program when the battery gets really low.
February 15, 2011 4:19 PM Subscribe
Looking for a Mac program (or some other way) that will monitor my MacBook's battery and turn off another program when the battery gets really low.
I run certain programs on my computer at all times, and all I want is a program that I can run that will monitor the battery status of my computer, and turn off certain other programs if the battery gets too low. It would be nice if this program ran in the menu bar, and it would also be nice if I could set the battery percentage at which this program starts to kill these other programs. I've looked through Google, asked on MacRumors, etc., but I haven't been able to find anything thus far. Someone please tell me that you've got something that will help me.
Thanks!
I run certain programs on my computer at all times, and all I want is a program that I can run that will monitor the battery status of my computer, and turn off certain other programs if the battery gets too low. It would be nice if this program ran in the menu bar, and it would also be nice if I could set the battery percentage at which this program starts to kill these other programs. I've looked through Google, asked on MacRumors, etc., but I haven't been able to find anything thus far. Someone please tell me that you've got something that will help me.
Thanks!
I don't know of any program that will do it, but here's a quick bash script that can be tossed into a cronjob. :
posted by Cat Pie Hurts at 6:00 PM on February 15, 2011
#!/bin/bash #Get remaining battery life and cleanup output BATTERY=`pmset -g batt|egrep [0-9]|awk '{ print $2 }'| awk -F% '{ print $1 }'` #Get PID for program 1. Change applicationName to appropriate app APP1=`ps aux|grep applicationName|awk '{ print $2 }'` #Get PID for program 2. Change applicationName to appropriate app APP2=`ps aux|grep applicationName2|awk '{ print $2 }'` #if Battery percentage is less than 50%, kill the listen apps. Change 50 to whatever is appropriate if [[ $BATTERY < 50 ]]; then killall $APP1 $APP2 fi
posted by Cat Pie Hurts at 6:00 PM on February 15, 2011
This is what I get for not checking before I paste. Should be:
#!/bin/bash
#Get remaining battery life and cleanup output
BATTERY=`pmset -g batt|egrep [0-9]|awk '{ print $2 }'| awk -F% '{ print $1 }'`
#if Battery percentage is less than 50%, kill the listed apps. Change 50 to whatever is appropriate
if [[ $BATTERY < 50 ]]; then
killall APP1 APP2
fi
posted by Cat Pie Hurts at 6:07 PM on February 15, 2011 [1 favorite]
#!/bin/bash
#Get remaining battery life and cleanup output
BATTERY=`pmset -g batt|egrep [0-9]|awk '{ print $2 }'| awk -F% '{ print $1 }'`
#if Battery percentage is less than 50%, kill the listed apps. Change 50 to whatever is appropriate
if [[ $BATTERY < 50 ]]; then
killall APP1 APP2
fi
posted by Cat Pie Hurts at 6:07 PM on February 15, 2011 [1 favorite]
This thread is closed to new comments.
posted by travis08 at 5:04 PM on February 15, 2011