如何在 init.d 中获取脚本以在 Android 启动时执行? [英] How to get a script in init.d to execute on boot in Android?
问题描述
我的 android 应用程序的一部分功能是放置我在 init.d 中编写的脚本,以便它在每次启动时执行.(显然我的应用仅适用于 root 用户)
Part of my android app's functionality it to place a script I have written in init.d, so that it will be executed on every startup. (obviously my app is for root users only)
这是我在做什么:
busybox mount -o rw,remount /system"
busybox cp -f /sdcard/*******/script /system/etc/init.d/script
busybox chmod +x /etc/init.d/script
update-rc.d script 99
update-rc.d script 99"行是我遇到麻烦的地方,它失败并出现update-rc.d not found"错误.
The "update-rc.d script 99" line is where I run into trouble, it fails with an "update-rc.d not found" error.
有谁知道在 Android 中进行这项工作的正确命令是什么??
Does anyone know what the proper command would be to make this work in Android??
我意识到这并不是发布这个问题的最合适的地方,但我已经意识到这个社区对这些问题非常了解.
I realize that this isn't exactly the most appropriate place to post this question, but I have come realize that this community is extremely knowledgeable on these matters.
推荐答案
将类似的内容添加到您的 init.rc
Add something like this to your init.rc
service script /system/etc/init.d/script
oneshot
Android 中没有 update-rc.d
因为也没有 SYSV init.
There's no update-rc.d
in Android because there's no SYSV init either.
这篇关于如何在 init.d 中获取脚本以在 Android 启动时执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!