How to keep running a process in Android when disconnecting adb terminal? command "nohup" not found

7,119

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.

Share:
7,119

Related videos on Youtube

xuiqzy
Author by

xuiqzy

Updated on September 18, 2022

Comments

  • xuiqzy
    xuiqzy over 1 year

    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?

  • xuiqzy
    xuiqzy over 9 years
    It works with setsid now, it continues after disconnecting adb and after pressing ctrl + c also. Has it some disadvantage to nohup? setsid is also listed in the installed packages in the busybox installer whereas nohup is missing and therefore is not installed, busybox nohup somecommand also doesn't work so it's not only not linked.
  • Drake Clarris
    Drake Clarris over 9 years
    On my phone, nohup is part of my busybox - using busybox v1.22.1-Stericson. What kind of device is this?
  • xuiqzy
    xuiqzy over 9 years
    I used this installer to install it without needing to set up and download from play store. It installed the version 1.20.1 with smart install (only install missing applets) in /system/bin. Can you give me a link to an installer that installs the new version or the new version itself? Maybe one of those? But in theory setsid should do the same, or what's the difference?
  • Drake Clarris
    Drake Clarris over 9 years
    The link is in my post to the play store app. But if setsid is working, I wouldn't necessarily worry about it. Just wanted to know why I had nohup and you did not.
  • xuiqzy
    xuiqzy over 9 years
    Okay, I saw the link. I just wanted to have an option to do it without WiFi and SIM (because sometimes it crashed so quickly I could't download anything and then bootlooped till factory reset). Can I take the first one in my link to XDA or is it a version that (partly) isn't adapted to Android?
  • Drake Clarris
    Drake Clarris over 9 years
    The stericson one in your link is the same as the one installed by that app.
  • xuiqzy
    xuiqzy over 9 years
    But that's one version behind 1.22.1, perhaps it also includes nohup
  • xuiqzy
    xuiqzy over 9 years
    By the way, 1.22.1 also didn't include nohup for me, with the Stericson google play installer.