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!
screenortmuxto create a terminal you can disconnect at any time. – Robert Sep 27 '22 at 09:12