Scheduled Tasks¶
Scheduled tasks are used to periodically execute scripts or other tasks. The usage of this scheduled task function follows the standard Linux Crontab syntax, except that the specific commands might differ. All scheduled tasks will be executed with root privileges. You should have basic knowledge of writing crontab rules; if you’re unfamiliar, please learn about it first.
Attention
Due to Android’s sleep mechanism, scheduled tasks may not run at the expected time after the screen turns off. You may need to keep your device screen on to ensure tasks execute as intended.
To use this feature, open the remote desktop terminal included in FIRERPA, the built-in ADB terminal, or an SSH terminal. After entering the terminal, run the command crontab -e to enter edit mode. Press the letter i in English input mode, then write your desired cron rules. To save and exit, press ESC, then SHIFT + :, type wq, and press Enter. Below are some example rules:
@reboot echo Executed when the framework starts
0 */1 * * * echo Executed every hour
* * * * * echo Executed every minute
0 8 * * * echo Executed daily at 8:00 AM
If you want to save the output of a scheduled task, simply use standard input/output redirection:
* * * * * echo hello >/data/usr/script.log 2>&1
After writing your crontab rules, it is recommended to verify their correctness using an online crontab validation tool.