zsh.li Linux Blog My Memories About ?

Dear My
Linux

Automatic shutdown in Android.

POST_AT

I used to recommend to automatic enable the Airplane mode at night, but to tell you the truth that application started to fail. It is a pity that the Android phone cannot automatically wake up like most of the modern computers.

But at least I want a quiet sleep, so it isn't that bad relay on a traditional Alarm Clock while the Cellphone do automatically shutdown in night.

There is an application in the Play Store to automatically shutdown the phone, but you know, I foremost recommend you to use Linage OS instead Android, second to uninstall the Play Store, and finally to only use Open Source Software (F-droid).

So you will be able to do this with Free Software:

Requeriments:

  • Rooted phone
  • Su installed
  • Busybox (Vi)
  • A Terminal Emulator (Termux recommended)

1. In the F-droid store install Crond.

2. Open Crond

3. Open a terminal and execute su

4. Execute vi /data/crontab and add:

0 21 * * * poweroff -n -f

Where 0 are the minutes, and 21 the hour, and the following asterisk are wildcards, you can learn more about how to use cron and crontab for further customización

Crond is pretty powerful if you know about the Linux command line and/or programming.