I setup my iPhone to automatically shutdown every night to save battery life

Discussion in 'iOS Software' started by bigviking, Aug 14, 2007.

  1. bigviking

    bigviking New Member
    Bronze

    Joined:
    Jul 4, 2007
    Likes Received:
    0
    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
     
  2. seb481

    seb481 New Member
    Silver

    Joined:
    Aug 3, 2007
    Likes Received:
    1
    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 :)
     
  3. stevetim

    stevetim New Member
    Silver

    Joined:
    Jul 20, 2007
    Likes Received:
    0
    How do you override the commands without a CPU? And, does it turn off while in use?
     
  4. OJsakila

    OJsakila New Member

    Joined:
    Jul 15, 2007
    Likes Received:
    1
    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....
     
  5. SCMedic

    SCMedic New Member
    Bronze

    Joined:
    Jul 7, 2007
    Likes Received:
    0
    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.
     
  6. Velodog2

    Velodog2 Member
    Silver

    Joined:
    Jul 19, 2007
    Likes Received:
    0
    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.
     
  7. bigviking

    bigviking New Member
    Bronze

    Joined:
    Jul 4, 2007
    Likes Received:
    0
    It is easy to just turn it off, but ...

    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.
     
  8. jacjac2

    jacjac2 New Member
    Bronze

    Joined:
    Jul 1, 2007
    Likes Received:
    0
    I have written a program very similar to this....... called one push of button with my finger, lol.... Just had to say it.
     
  9. Tinman

    Tinman Evangelist
    Gold

    Joined:
    Jul 16, 2007
    Likes Received:
    183
    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
     
  10. seb481

    seb481 New Member
    Silver

    Joined:
    Aug 3, 2007
    Likes Received:
    1
    Criticism is what makes things evolve. I am not here to talk crap about the program. Just want to emulate the debate, that's it
     
  11. Tinman

    Tinman Evangelist
    Gold

    Joined:
    Jul 16, 2007
    Likes Received:
    183
    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
     
  12. bigviking

    bigviking New Member
    Bronze

    Joined:
    Jul 4, 2007
    Likes Received:
    0
    Required binutils /setup info


    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.
     
  13. SF_VR6

    SF_VR6 New Member
    Bronze

    Joined:
    Jul 1, 2007
    Likes Received:
    0
    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) :)
     
  14. Hondamaker

    Hondamaker Genius
    Gold

    Joined:
    May 14, 2007
    Likes Received:
    633
    Hey, at least he's smart enough to write a program for the iPhone. Nice job!
     
  15. machd

    machd New Member

    Joined:
    Aug 1, 2007
    Likes Received:
    0
    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?
     
  16. bigviking

    bigviking New Member
    Bronze

    Joined:
    Jul 4, 2007
    Likes Received:
    0
    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 ?
     
  17. machd

    machd New Member

    Joined:
    Aug 1, 2007
    Likes Received:
    0
    Can you pkease explain how it saves battery life? Compare what you want to do to plugging it in overnight?
     
  18. bigviking

    bigviking New Member
    Bronze

    Joined:
    Jul 4, 2007
    Likes Received:
    0
    I can't state it a more simple way than I just did

    Please carefuly 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.
     
  19. machd

    machd New Member

    Joined:
    Aug 1, 2007
    Likes Received:
    0
    i understood. So essentially the only benefits arise wjen you don't want to plug it in. If uou plug it in then there is no benefit? Im just trying to understand.
     
  20. SmartAlx

    SmartAlx Zealot
    Gold

    Joined:
    Jun 7, 2007
    Likes Received:
    8
    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.
     

Share This Page