开发者

Issue running a script from init.rc on device boot up

开发者 https://www.devze.com 2023-02-11 01:52 出处:网络
I am trying to run a shell script, which copies a file to a specific location, on phone power up and I added the following to my init.rc file:

I am trying to run a shell script, which copies a file to a specific location, on phone power up and I added the following to my init.rc file:

service test_copy /system/bin/sh /system/bin/test_copy.sh  
    class pre-zygote_services  
    oneshot  
    user system  
    group system  

When the service name (test_copy) is same as the script name, test_copy in this case, it doesn't execute the script but if I change the service name to a different one, like start_test_copy, it works. I am just eager to know the reason on why when service name is same as script开发者_如何学C name it doesn't work or am I wrong?


Try this one in your init.rc:

service test_copy /system/bin/test_copy.sh
user root
oneshot

Your test_copy.sh script must begin with:

#!/system/bin/sh


Always make sure use a different name for your service which Android init recommends.

Also, you can make your test_copy.sh into the executable by defining the Android Make file.

0

精彩评论

暂无评论...
验证码 换一张
取 消