如何让一个脚本在init.d下在Android的开机执行? [英] How to get a script in init.d to execute on boot in Android?

查看:1790
本文介绍了如何让一个脚本在init.d下在Android的开机执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

部分我的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.

这篇关于如何让一个脚本在init.d下在Android的开机执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆