简体   繁体   中英

nohangup using ADB shell

I am trying to do a logcat to a file using adb shell by following command -

adb shell "nohup logcat -f /storage/sdcard0/myLog.txt -v time &"

If I do a ps | grep logcat ps | grep logcat , I don't see the logcat command. Even I tried to see nohup command, but it is not there. So somehow above command does not work.

However if I perform the command in 2 steps it works fine -

  1. adb shell
  2. nohup logcat -f /storage/sdcard0/myLog.txt -v time &

I can see the process using ps and logcat continues to record to the file even if I disconnect adb shell. Now I would like the first command to work, since I am using python scripts to issue commands via ADB. It is possible to change the python scripts, however I would like to know if I am doing anything wrong in issuing the first command and if it is possible to make it work.

try

adb logcat

not

adb shell logcat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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