|problems with starting a shell script at boot time from init.<target>.rc||Pieter||8/1/12 12:12 AM|
I am trying to call a script at boot time. The script is available inside /system/sbin, but it seems it is not executed.
Here are the details.
In my init.<target>.rc:
service sampleservice /system/bin/sh /system/sbin/samplescript.sh
The script itself:
echo The sample script works!
echo "The sample script works!" > /data/misc/samplescript
The permissions of /system/sbin/samplescript.sh are as follows: -rw-r--r--
Doing from command line "sh /system/sbin/samplescript.sh" works perfectly, but it seems the script is not executed at boot time. There are no entries in /data/misc/samplescript
* How can I resolve this issue? Where should I see the output of the "echo" command? Is there another/better way to have it printed in logcat or dmesg?
* The script itself is not executable. Does this matter and if yes, how do I have to make it executable? In my original directory it is executable, but somehow during the copy process (with PRODUCT_LOCAL_COPY) the executable rights disappear.
* Another option I see is that I did not "register" a service as such (e.b. by specifiying "LOCAL_MODULE" in your Android.mk and mention it in core.mk) and perhaps this is just not the right way to call a sh script at boot time?
Any help is more than welcome!
|Re: problems with starting a shell script at boot time from init.<target>.rc||Pieter||8/2/12 12:47 AM|
I solved it. It seems you have to specify the class, otherwise it is in the class "default". In your init.rc, there are only statements for class_start core and class_start main. So you have to specifiy the class and add (if needed) an appropriate class_start statement.
|Re: [android-kernel] Re: problems with starting a shell script at boot time from init.<target>.rc||Distrovix_DEV_TEAM||8/2/12 10:44 AM|
|Re: problems with starting a shell script at boot time from init.<target>.rc||William Roberts||8/2/12 7:24 PM|
Shouldn't be executable?
We have something in SE Android that uses something similair in out init.rc we have:
service netlabels /system/bin/selinux-network.sh
And our Android.mk for the project has this:
LOCAL_MODULE := selinux-network.sh
LOCAL_SRC_FILES := $(LOCAL_MODULE)
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)
It is important to note that the shell file is executable in the project directory, this way when it gets added to the image it is executable as well.
Hope this helps...
|Re: problems with starting a shell script at boot time from init.<target>.rc||Felipe Nipo||10/3/12 10:07 PM|
very thank you for this solution, i hadn't no way to solve this problem,
but your solution works fine for me!! :D
Em quinta-feira, 2 de agosto de 2012 04h47min17s UTC-3, Pieter escreveu: