How to use crontab in Android?


1.Root access

2.Busybox : for ‘crond’ service

3.init.d : to start ‘crond’ service at boot

Creating cronjob

Create the cronjob file in directory /data/crontab/ with filename root. Write your cronjob inside the file ‘root’. Set executable permissions for the file ‘root’

Test without rebooting

Now open any terminal emulator in device and run the following commands..

su –

crond -b -c /data/cronjob

Now the crond service will start, to check type…

top | grep crond

Start crond at booto

create a file at /system/etc/init.d with executable permission and enter the following lines

crond -b -c /data/crond

Example cronjobs

53 * * * * reboot

Will reboot your device on 53rd minute of every hour.

浏览:2455 Views views


Please type the characters of this captcha image in the input box