Shell – How to keep running a process in Android when disconnecting adb terminal? command “nohup” not found

adbandroidnohupshell

I'm trying to analyze the reason for random reboots of my phone (see here).
Therefore I wanted to record the logcat and kernel messages till the restart to see the logs even after the usb disconnects, which is probably earlier than the restart?!

So I constantly copied proc/kmsg and the logcat to files. Now this needs to NOT stop when ADB disconnects. I already tried nohup, disown, setsid, putting it in braces. Tried everything from this question.
But all these commands were not found in the shell.

So do you have another command or method for me to achieve what I want? Can I install some package / module like screen for this to work or does another (custom) kernel could help in some way?

Best Answer

If you install the busybox binary, it includes the nohup command (this will require root access). Busybox may be present, but the command not symlinked, in which case you would need to use busybox nohup command. If busybox is not present, then the easiest way to install is with busybox installer. After that is installed (again, with root privileges), you simply can use nohup command from adb or terminal emulator.

Related Question