Problem with running script from init.rc on device boot

I try to run a shell script that copies the file to a specific location when the phone is turned on, and I added the following to the 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) matches the name of the script, test_copy in this case, it does not execute the script, but if I changed the name of the service to another, for example start_test_copy , this works. I just want to know the reason why, when the service name matches the name of the script, it does not work or am I mistaken?

+4
source share
2 answers

Try this in init.rc:

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

Your test_copy.sh script should start with:

 #!/system/bin/sh 
+2
source

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

Alternatively, you can turn your test_copy.sh into an executable by defining an Android Make file.

0
source

Source: https://habr.com/ru/post/1339794/


All Articles