A command line Android automatic shutdown

A few days ago to sleep at night, I can't sleep sleep, so want to listen to Ono Lisa's song Nexus7, sleep in peace. (how to feel a bit. . . )But don't let flat always this loop. (about Google Play Music room), so the open Terminal in the flat, made a series of attempts, the announcement does not exist the shutdown command, the reboot command help also provides only a little parameter, so I have on Baidu Google Sogou, read a lot of materials, found a reboot usage, strange, when reboot --help how have never seen the P parameter? The following is to use the method of P parameters:

$ su
# reboot -p

The P parameter of the reboot command

This in my Nexus7 test is available, it is power off, and was an instant shutdown, so I think of Linux under the sleep command allows Terminal to wait for a specified time, ha ha, so timing shutdown can be constructed for this statement:

$ su
# sleep 10 && reboot -p

Test the success of! The meaning of this sentence is, the first super user privileges (need system is root), wait 10 seconds after shutdown command.

The P parameter reboot, found no official description in Terminal help explain the P parameter did not mention, so think of reboot and halt close relationship, we look at the helt parameter.:

# halt --help
usage: halt [-n] [-w] [-d] [-f] [-h] [-i] [-p]
    -n: don't sync before halting the system
    -w: only write a wtmp reboot record and exit.
    -d: don't write a wtmp record.
    -f: force halt/reboot, don't call shutdown.
    -h: put harddisks in standby mode.
    -i: shut down all network interfaces.
    -p: power down the system (if possible, otherwise halt).

The parameters of the halt command

See the last of a p parameter? To help illustrate that is: power down the system (if possible, otherwise halt).

Translation: if you can shut down the system will shut down the system, not to shut down the system if it terminates the execution of commands.

The seconds off, do not know the impact on the system, the author.

Posted by Warner at November 22, 2013 - 4:51 PM