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

How to start daemon on android by adb

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

我正在尝试 运行 android emu/device 上的守护进程,命令如下:

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

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

如果我这样做:

adb -s <device> shell

然后形成 shell cmdline:

su -c /dir/daemon <port_number>

比它的工作还好。我尝试使用 shell-script 和 运行:

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 - 它的工作。另一个问题是在不同的 device/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> &