Use busybox crond, crontab on Android

  1. Download busybox binary or compile busybox to get busybox

  2. push busybox to android device
    # ./adb push busybox /data/busybox

  3. create /etc/passwd /etc/group /etc/shadow
    (android shell) # cd /data
    (android shell) # touch passwd
    (android shell) # touch group
    (android shell) # touch shadow
    (android recovery mode) # ln -s /data/passwd /system/etc/passwd
    (android recovery mode) # ln -s /data/group /system/etc/group
    (android recovery mode) # ln -s /data/shadow /system/etc/shadow

  4. create Symbolic linker /bin/sh /bin/vi
    (android shell) # mount -o remount,rw rootfs /
    (android shell) # mkdir /bin
    (android shell) # ln -s /system/bin/sh
    (android shell) # ln -s /system/xbin/vi

  5. create folder /var/spool/cron/crontabs
    (android shell) # mkdir /var
    (android shell) # mkdir /var/spool
    (android shell) # mkdir /var/spool/cron
    (android shell) # mkdir /var/spool/cron/crontabs

  6. create file root (crontab)
    you can use vi or ./busybox crontab -e to create file
    (android shell) # vi /var/spool/cron/crontabs/root
    (android shell) # ./busybox crontab -e
    file format
    M H d m w CMD
    * * * * * command
  7. run crond
    (android shell) # ./busybox crond -l 0 -L /data/cron.log

1 則留言:

  1. hi~
    when I input 'busybox crond -l 0 -L /data/cron.log'
    I cat /data/cron.log, but there is nothing.

    my /var/spool/cron/crontabs/root is like this
    * * * * * /bin/reboot
    my android device should reboot in every minutes.
    But it didn't work. Can you give me some suggestion?

    回覆刪除