PDA

View Full Version : I setup my iPhone to automatically shutdown every night to save battery life


bigviking
08-14-2007, 05:59 PM
Last night I had a thought that it would be nice to have my iPhone turn itself off at the same time every night in order to save battery life.

I have written a command line program that can be used to shutdown or reboot your iPhone, and included some instructions that show how to setup the scheduler (cron) to automatically shutdown your iPhone every night.

Anyone that is interested in this can download the software from http://dave.henriksen37.googlepages.com/iphonesoftware

seb481
08-15-2007, 01:37 AM
That's great but can't you just turn off the iPhone yourself? I mean, it takes about 2 seconds. Besides, I don't go to bed at the same time every night and sometimes I want my phone to be on all night long. Anyways. Good job on the program though, I could not do such a job so I have to respect your work :smile:

stevetim
08-15-2007, 02:09 AM
How do you override the commands without a CPU? And, does it turn off while in use?

OJsakila
08-15-2007, 05:50 AM
hey good work. Pretty cool, dude. I leave mine on 24/7, however. Never know when I might get THAT call... Plus my battery is the apparently the only battery with zero problems. The thing lasts forever....

SCMedic
08-15-2007, 06:51 AM
Nice little script, but seriously, the button doesn't hut my finger THAT bad to hold it down...


I also have 0 battery problems.. Once every two days or so I charge it.

Velodog2
08-15-2007, 08:27 AM
I wasn't that interested in this thread, but I did happen to notice something a couple days ago that is relevant. If you power down the iPhone, then put it in the charging cradle, it will power itself back up. No kidding. I thought that was slightly weird and somehow a little creepy, lol. I also didn't try to repeat it to verify.

bigviking
08-15-2007, 09:01 AM
I agree with the other posters, it is pretty easy to just turn it off before you go to bed. But, I typically want it on until I go to bed, and it's one less thing for me to remember to do.

Just trying to offset my so called "carbon footprint" a little.

Just kidding, it wont make up for the fact that I will always drive a 4x4 SUV.

jacjac2
08-15-2007, 10:29 AM
Last night I had a thought that it would be nice to have my iPhone turn itself off at the same time every night in order to save battery life.

I have written a command line program that can be used to shutdown or reboot your iPhone, and included some instructions that show how to setup the scheduler (cron) to automatically shutdown your iPhone every night.

Anyone that is interested in this can download the software from http://dave.henriksen37.googlepages.com/iphonesoftware

I have written a program very similiar to this....... called one push of button with my finger, lol.... Just had to say it.

Tinman
08-15-2007, 01:28 PM
Folks, enough with the criticism!

Whether you have an interest in this particular functionality or not, you should be happy to see iPhone development.

And look beyond the functionality of this app and you might see how useful being able to control iPhone events via a schedule can be.

In the future this could lead to apps that, say, turn WiFi/BT off at certain hours of the day. Or perhaps change the ringtone at night. Lots of possibilities here.

To the OP: Bravo!


--
Mike

seb481
08-15-2007, 03:05 PM
Criticism is what makes things evolve. I am not here to talk **** about the program. Just want to emulate the debate, that's it

Tinman
08-15-2007, 03:27 PM
Criticism is what makes things evolve. I am not here to talk **** about the program. Just want to emulate the debate, that's it
I have no idea what you mean by "emulate the debate", but criticism like "That's great but can't you just turn off the iPhone yourself?" is merely insulting to the person who wrote this app and no doubt is well aware of how to turn his iPhone off. There is much more going on here than just turning off the iPhone. That's why it is posted in the software forum. It's not like he posted how to turn off the iPhone using its sleep button in the hardware forum.

If this is what the OP can look forward to when posting I wouldn't blame him if he never posted again.

Finally, this little utility can be used right now to "shutdown or reboot" the iPhone. Note the emphasis on "reboot." I tested it and it works. As I like to reboot my iPhone regularly anyway, I am going to automate this nightly (@3 AM). I like this because the iPhone will be on the charger anyway, and when I reboot during the day it destroys the usage stats. And the iPhone is only off for a minute or so, while it reboots.

To the OP: I can get shutdown to work, but I'd like to know exactly which utilities you need from the binkit. I'd rather not install it all. Right now cron is not working right. I did not receive any error when running "launchctl load com.cron.plist" BTW. But I have not been able to get scheduling to work. I modified crontab to this (only wanted a reboot, and my last test was for 1:15 PM):
15 13 * * * root /sbin/shutdown -r


--
Mike

bigviking
08-16-2007, 09:51 AM
I have no idea what you mean by "emulate the debate", but criticism like "That's great but can't you just turn off the iPhone yourself?" is merely insulting to the person who wrote this app and no doubt is well aware of how to turn his iPhone off. There is much more going on here than just turning off the iPhone. That's why it is posted in the software forum. It's not like he posted how to turn off the iPhone using its sleep button in the hardware forum.

If this is what the OP can look forward to when posting I wouldn't blame him if he never posted again.

Finally, this little utility can be used right now to "shutdown or reboot" the iPhone. Note the emphasis on "reboot." I tested it and it works. As I like to reboot my iPhone regularly anyway, I am going to automate this nightly (@3 AM). I like this because the iPhone will be on the charger anyway, and when I reboot during the day it destroys the usage stats. And the iPhone is only off for a minute or so, while it reboots.

To the OP: I can get shutdown to work, but I'd like to know exactly which utilities you need from the binkit. I'd rather not install it all. Right now cron is not working right. I did not receive any error when running "launchctl load com.cron.plist" BTW. But I have not been able to get scheduling to work. I modified crontab to this (only wanted a reboot, and my last test was for 1:15 PM):
15 13 * * * root /sbin/shutdown -r


--
Mike


The only utilities needed are:

shutdown
cron
crontab

You need to do the launchctl load com.cron.plist to make cron run on reboot. Make sure com.cron.plist is in /System/Library/LaunchDaemons

You also always need to do a "crontab - u root /etc/crontab" whenever you update the /etc/crontab file, followed by restarting cron (which can be done by rebooting the phone).

After editing the crontab file, running the crontab command, and rebooting the phone just login and type ps -aux to verify that the actual cron command is running.

Hope this helps.

I may make an actual gui app that does all the behind the scenes stuff automatically without requiring cron.

Anyway, as some others have said if anyone out there would rather manually shutdown their phone, or recharge it every night, go for it.

Also, all I did was write the shutdown command with reboot and halt capabilities, the other stuff was in the original binutils package.

SF_VR6
08-17-2007, 02:18 AM
I think the time it took for you to write the code will equal to the total time of turning off your iPhone for the life of your iPhone (2 seconds each eveneing) :)

Hondamaker
08-17-2007, 11:58 AM
Hey, at least he's smart enough to write a program for the iphone. Nice job!

machd
08-17-2007, 05:32 PM
how exactly does this save battery life? Once charged in the dock, the phone no longer uses the battery hence not counting toward your number of cycles? Isn't this how mac notebooks work too? Is my assumption wrong?

bigviking
08-24-2007, 08:25 PM
how exactly does this save battery life? Once charged in the dock, the phone no longer uses the battery hence not counting toward your number of cycles? Isn't this how mac notebooks work too? Is my assumption wrong?

For the people that just can't understand this, let me make it simple:

If you sleep at night, and don't want to plug your phone in every night, having the phone shut itself off will save battery life when you aren't using the phone, and keeps you from having to remember to shut it off every night.

I now have a working program that automatically grabs some daily radio talk show mp3s, and throws them into my music library via WiFi or Edge.

But, I'm sure nobody would want that when you can just plug your phone into your computer every day to do it right ?

machd
08-24-2007, 08:31 PM
For the people that just can't understand this, let me make it simple:

If you sleep at night, and don't want to plug your phone in every night, having the phone shut itself off will save battery life when you aren't using the phone, and keeps you from having to remember to shut it off every night.

I now have a working program that automatically grabs some daily radio talk show mp3s, and throws them into my music library via WiFi or Edge.

But, I'm sure nobody would want that when you can just plug your phone into your computer every day to do it right ?

Can you pkease explain how it saves battery life? Compare what you want to do to plugging it in overnight?

bigviking
08-24-2007, 08:36 PM
Can you pkease explain how it saves battery life? Compare what you want to do to plugging it in overnight?

Please carefully read the above post again. It just can't be said in a more simplistic way than it was above. I think everyone else probably can understand what I said.

Try noggin.com if you need something easier to follow.

And thats all I have to say about that.

machd
08-24-2007, 08:48 PM
Please carefully read the above post again. It just can't be said in a more simplistic way than it was above. I think everyone else probably can understand what I said.

Try noggin.com if you need something easier to follow.

And thats all I have to say about that.

i understood. So essentially the only benefits arise wjen you dont want to plug it in. If uou plug it in then there is no benefit? Im just trying to understand.

SmartAlx
08-25-2007, 12:43 PM
Folks, enough with the criticism!With all due rrspect, You are out of line here. The attitude of the thread was positive before you showed up. Sure, people said "of what use is it," but their attitude was light hearted and pretty much ompressed with his ability to wrute a script like this.

Please let's keep the snideness and defensiveness to a minimum y'all.

aknightstale41
08-26-2007, 12:10 AM
Last night I had a thought that it would be nice to have my iPhone turn itself off at the same time every night in order to save battery life.

I have written a command line program that can be used to shutdown or reboot your iPhone, and included some instructions that show how to setup the scheduler (cron) to automatically shutdown your iPhone every night.

Anyone that is interested in this can download the software from http://dave.henriksen37.googlepages.com/iphonesoftware
I dream of Frishes Big Boy bringing me a golden Iphone on a platter that has just been updated with patch number 999999.99.01

Hondamaker
08-26-2007, 02:15 AM
There is a feature with the timer in the iPhone that allows you to set it to sleep after so many mins. Is that the same thing?

Foo Fighter
08-26-2007, 02:22 AM
hey good work. Pretty cool, dude. I leave mine on 24/7, however. Never know when I might get THAT call... Plus my battery is the apparently the only battery with zero problems. The thing lasts forever....

Same with me

RTpics
08-26-2007, 04:54 AM
There is a feature with the timer in the iPhone that allows you to set it to sleep after so many mins. Is that the same thing?

No, but it would be nice to have that option when you set the "wake alarm"

vsc
08-26-2007, 09:35 AM
Could you post the program cited?

Note that it would appear that this forum is not the best for this discussion. Suggest something like,

http://hackint0sh.org/forum/forumdisplay.php?f=123

In any case good job!



I now have a working program that automatically grabs some daily radio talk show mp3s, and throws them into my music library via WiFi or Edge.

But, I'm sure nobody would want that when you can just plug your phone into your computer every day to do it right ?

Kipper
08-26-2007, 01:21 PM
Props to u bigviking. Anything to help the development I'm all for it!!!:2cool:

Soulquarian
09-01-2007, 01:23 AM
Nice App.

Despite all the useless "can't you just turn your phone off manually?" comments, I LOVED this feature on my Blackberry. Sometimes I'd leave my phone in my pants pocket, or have it in another room, and having it turn off/on by itself was definitely a battery saver.

Kudos to you sir. :)