Scheduled Tasks

Scheduled tasks are used to periodically execute scripts or other tasks. These scheduled tasks follow the standard Linux Crontab syntax; except for some possible differences in commands, the syntax is identical. All rules will be executed as the user running the service. You need to be able to write basic Crontab rules; if you are unfamiliar, please study them on your own first.

Attention

Due to Android's sleep mechanisms, scheduled tasks may not run at your expected time after the screen is turned off. You may need to set the device to stay awake for scheduled tasks to execute at your intended times.

You need to use this feature within FIRERPA's built-in remote desktop terminal, built-in ADB terminal, or SSH terminal. After entering the terminal, execute the command crontab -e to enter the editing interface, press the i key to enter insert mode, and then write the relevant rules. Then press the Esc key, followed by Shift + : (to type a colon), type wq and press Enter to save. Some example rules are as follows.

@reboot      echo Executes when the framework starts
0 */1 * * *  echo Executes every hour
* * * * *    echo Executes every minute
0 8 * * *    echo Executes at 8:00 every day

If you want to save the output of a scheduled task, simply use standard input/output redirection:

* * * * *    echo hello >/data/local/tmp/script.log 2>&1

It is recommended to use an online Crontab validation website to verify the accuracy of your rules.