简体   繁体   English

如何使用 ADB 作为后台进程运行命令?

[英]How to run command as background process using ADB?

I am trying to run logcat in background using adb.我正在尝试使用 adb 在后台运行 logcat。

adb shell "logcat -r 2000 -f /data/local/test.log &"

But it does not work.但它不起作用。 If I do adb shell ps | grep logcat如果我做adb shell ps | grep logcat adb shell ps | grep logcat I dont see logcat process running. adb shell ps | grep logcat我没有看到 logcat 进程正在运行。

添加 nohup 似乎有效。
adb shell "nohup logcat -r 2000 -f /data/local/test.log &"

If you can't run nohup directly, then you could try this: busybox nohup logcat如果你不能直接运行 nohup,那么你可以试试这个:busybox nohup logcat

BusyBox combines tiny versions of many common UNIX utilities into a single small executable. BusyBox 将许多常见 UNIX 实用程序的小版本组合到一个小的可执行文件中。 So it has nohup feature as well and you could use it via busybox if manufacturer turns nohup option on at compile time.所以它也有 nohup 功能,如果制造商在编译时打开 nohup 选项,你可以通过 busybox 使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM