Reputation: 21
I was able to start my own services from the init script (init.rc) in Android, following the guides found at: http://www.androidenea.com/2009/08/init-process-and-initrc.html or with the official documentation found at https://android.googlesource.com/platform/system/core/+/froyo-release/init/readme.txt
There is a trigger called "on service-exit-<name>" where name is the name of the service which has to exit before the actions of this trigger are executed. However, this trigger does not seem to work. I started a small shell script as a service and created the trigger accordingly to start all remaining services afterwards. The init process seems to be stuck after the execution of my script and does not continue with the remaining services.
The final goal would be to achieve something like a controlled or 'staged' boot process, where I can make sure that this script is executed first and then the remainnig services are started. I also tried to accomplish that with using different service classes but failed
Any help on that subject is appreciated.
Upvotes: 2
Views: 9022
Reputation: 91
Judging from the source code (system/core/init/init.c
) this option is documented but not implemented.
Upvotes: 1
Reputation: 91
reading the sources i found that init sets a property (init.svc.<name>) to "stopped" when a service exits. this means you can use property triggers to achieve what service-exit-<name> is supposed to do:
service 2nd_svc /system/bin/2nd_svc
oneshot
disabled
on property:init.svc.1st_svc=stopped
start 2nd_svc
Upvotes: 8