How to execute a shell script from init.rc after boot finished

Place something like this in your init.rc:
on property:dev.bootcomplete=1
    start bootcomplete_handler

service bootcomplete_handler /system/bin/sh /system/bin/bc_handler.sh
    class late_start
    user root
    group root
    disabled
    oneshot

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

strangly recovered every time after boot

Made like described btw after device rebooted init.rc looks like it was before and its date is 1970-01-01 02:00. Is there a way to stop its recovering?

Re: strangly recovered every time after boot

Did you create the /system/bin/bc_handler.sh (your own shell script that you want to launch on boot) file as well?
Here's a more comprehensive guide with lots of ideas:
http://android.stackexchange.com/questions/6558/how-can-i-run-a-script-on-boot

Eg. if you find that init.rc is reset during boot, you might have to modify your boot image too.