creating a cron job in android I want to write a bash script (similar to Linux) to run a cron job every 10 hour. The task is fairly simple, e.g. deleting files from cache folder.

According to this topic, I installed busybox and terminal emulator and phone has already been rooted. Here is what I did:

su -
echo "*/5 * * * * root reboot" &gt;&gt; /data/crontab/root
crond -b -c /data/cronjob


Note that for the test, I set the phone to reboot every 5 minutes to see if crond is properly working.

Problem is, it doesn't work! Any idea for that?
Requirements


Root access
Busybox : for 'crond' service
/system/etc/init.d folder 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 boot


mount system partition in read write :

su -

mount -o remount,rw /system
Create a file 99my_daemon at /system/etc/init.d with executable permission and enter the following lines

crond -b -c /data/crond
Close writing the /system partition

mount -o remount,rw /system
And reboot


Example of cron filename root

*/15 * * * * reboot


Will reboot your device every 15 minutes from o'clock.