How to run a command as a background process using ADB?

I am trying to run logcat in the background using adb.

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

But that will not work. If I do adb shell ps | grep logcat, I do not see the logcat process.

+5
source share
2 answers

Adding nohup seems to work.
adb shell "nohup logcat -r 2000 -f /data/local/test.log &"

+7
source

If you cannot run nohup directly, you can try this: busybox nohup logcat

BusyBox combines tiny versions of many common UNIX utilities into one small executable. Thus, it has a nohup function, and you can use it through busybox if the manufacturer disables the nohup option at compile time.

0
source

All Articles