android - 如何通过adb在android上启动守护进程

标签 android android-ndk adb

你能帮帮我吗,我的头肿了......

我正在尝试通过命令在 android emu/设备上运行守护进程:

adb -s <device_name> shell su -c /dir/daemon <port_number>

但没有想到发生,也没有错误!

如果我这样做:

adb -s <device> shell

然后形成 shell 命令行:

su -c /dir/daemon <port_number>

比它的工作还好。我尝试使用 shell 脚本并运行:

adb -s <device_name> shell sh su -c /dir/script.sh <port_number>

我什至尝试使用端口号从 Qt 代码生成脚本并使用:

adb -s <device_name> shell sh su -c /dir/script.sh

但它没有帮助...问题是如果我之前进入 adb shell 运行守护进程 - 它的工作。另一个问题是在不同的设备/emu/iso_image 上不同的命令格式无法工作。例如:

adb -s <device_name> shell su -c /dir/daemon <port_number> // work at emu, but not at iso

副:

adb -s <device_name> shell su -c "/dir/daemon <port_number>" // work at iso

等等

大家可以回答一下是怎么回事吗?

对不起我的英语

最佳答案

adb shell su -c "/dir > /dev/null 2> /dev/null < /dev/null &"

shell su -c /data/local/tmp/start_daemon.sh

#!/system/bin/sh
/data/local/tmp/nohup 
/data/local/tmp/daemon <portn_number> & 

关于android - 如何通过adb在android上启动守护进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38072723/

相关文章:

java - 从 Activity 中打开 fragment 并膨胀 View

android - ionic cordova run android --prod 事件无法正常工作

android - toast 来了多次

android - 为什么我的按钮在我的设备上运行时是透明的?

android - 将自定义cookie设置为ffmpeg http请求

android - ADB - Android - 获取当前 Activity 的名称

java - 在 Linux 上使用 Java 程序通过 ADB 在 android 设备上安装 apk

android - 检索Android手机的默认网关

android - fclose 在 android 和 linux 上的工作方式不同

android - adb命令检查设备是否加密