Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 name it doesn't work or am I wrong?

like image 219
Nikil Avatar asked Nov 06 '22 02:11

Nikil


1 Answers

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
like image 67
Ermir Avatar answered Nov 09 '22 11:11

Ermir