如何让一个脚本在init.d下在Android的开机执行?脚本、init、Android

2023-09-04 04:28:18 作者:∞今年流行、单身

部分我的Andr​​oid应用程序的功能,它把我写在init.d下的脚本,这样它会在每次启动时执行。 (很明显我的应用程序仅适用于超级用户)

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

更新-rc.d脚本99行是我碰到麻烦时,出现一个更新-的rc.d未找到错误。

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的无更新-的rc.d ,因为没有SysV初始化无论是。

There's no update-rc.d in Android because there's no SYSV init either.