One-line command to automatically shut down android

Source: Internet
Author: User

Http://www.cnblogs.com/libook/p/3186534.html

A few nights ago, I couldn't sleep, so I wanted to use nexus7 to listen to the song of little wild Lisa and go to bed in a quiet and peaceful manner (how do I feel a little bit ...) However, the tablet cannot always play in this loop (Google Play Music in the room), so I opened terminal on the tablet and made a series of attempts. The shutdown command did not exist, the help of the reboot command also provides only a few poor parameters, So I Google sogou hundreds of times and read a lot of information to find a reboot usage, strange, why didn't I see this p parameter during reboot -- help? The following describes how to use the p parameter:

$ su# reboot -p

The p parameter of the reboot command

This test is available in my nexus7, it is really power off, and it is an instant shutdown, so I remember that the sleep command in Linux can Let terminal wait for a specified time, haha, the following statement can be constructed to shut down at a specific time:

$ su# sleep 10 && reboot -p

Test successful! This statement means that the super user permission is obtained first (the system needs to be root), and the shutdown command is executed 10 seconds later.

For the p Parameter of reboot, the help description in terminal is not provided for this p parameter. If we think of the close relation between reboot and halt, let's take a look at the helt parameter description:

# halt --helpusage: 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).

Halt Command Parameters

Have you seen the last p parameter? The help description is: power down the system (if possible, otherwise halt ).

If the system can be shut down, the system will be shut down. If the system cannot be shut down, the execution of this command will be terminated.

 

Because it is second-off, do not know the impact on the system for the moment, here is a discussion.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.