1

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, 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.

Raj
  • 3,300
  • 8
  • 39
  • 67

1 Answers1

0

try

adb logcat

not

adb shell logcat
Alp
  • 3,027
  • 1
  • 13
  • 28
  • the reason to use adb shell logcat and not adb logcat is to be able to keep logging even if adb disconnects. I wanted to achieve that by using `nohup`. – Raj Jun 16 '15 at 13:18
  • I see. May be, [this](http://stackoverflow.com/questions/17385794/how-to-get-the-process-id-to-kill-a-nohup-process) could help you then: – Alp Jun 16 '15 at 14:20