0

I want to run a process in background and close the terminal, so the process remains active. I need to run the process as root. Since adb root doesn't work for me, I use adb shell; $ su to gain root privileges. I expect this to work: command &; exit or nohup command &; exit. It actually runs the process, but exit just waits for the process to terminate. I also tried to run sleep 10 &; exit, and exactly, the shell exits after 10 seconds (when all jobs are done). This happens only when su shell is used. It means that when I run adb shell; $ sleep 50 &; exit it exits immediately as expected. The problem also happens when I use su from termux (android package terminal). And also on my other device as well.

I can just kill the terminal, it does the job (process remains active as I wanted), but what is the proper way to exit the root shell when there are active jobs?

Thank you in advance!

2
  • On common Linux I would use screen or tmux to create a terminal you can disconnect at any time.
    – Robert
    Sep 27, 2022 at 9:12
  • It's a known issue I explained here years back. Related questions: this and this. Also beware of this. Sep 27, 2022 at 10:00

0

You must log in to answer this question.

Browse other questions tagged .