joaolkf comments on Request for help: Android app to shut down a smartphone late at night - Less Wrong

2 Post author: The_Jaded_One 02 April 2015 11:38AM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (30)

You are viewing a single comment's thread. Show more comments above.

Comment author: sixes_and_sevens 02 April 2015 11:59:57AM *  7 points [-]

Tasker is an Android app that lets you specify "contexts" (specific states of the phone), and carry out actions depending on these contexts. An example use-case might be something like "when I am connected to my home WiFi network, disable my screen lock".

One of the actions available under Tasker is "Run Shell", which lets you issue shell commands to the underlying operating system. To achieve your desired effect, you could:

  • Acquire Tasker (a few dollars)
  • Set it up to run with root privileges
  • Set a context of "between 11pm and 6am"
  • Set an action of the shell command "su -c shutdown -h now" (or something similar) to run under that context

This does seem quite hazardous, though. If an emergency happened at 3am, I'm pretty sure I'd want my phone easily available and usable.

ETA: I just Googled to see if there was an existing recipe for this. It turns out Android doesn't have a conventional shutdown terminal command, but does have the "reboot" command, with the switch -p for powering down. Tasker also has a "reboot" under System->Misc, with a power-down option on rooted phones. This can absolutely do what you want it to do. Just don't go having any emergencies between 11 and 6.

Comment author: joaolkf 02 April 2015 01:30:39PM *  1 point [-]

Thanks! This will be useful for me as well, it definitely seems better than my current solution: leaving my cell phone locked in my office(EDIT: at work).

Comment author: The_Jaded_One 02 April 2015 03:12:44PM 0 points [-]

I tried leaving it in another room for a while, but that lead to other problems, including trips to the other room at night to just look at one more message etc

Comment author: joaolkf 02 April 2015 03:36:38PM 0 points [-]

Sorry, I meant my office at work (yeap...). Fixed that.