Say I have a simple executable linux program that runs indefinitely in a loop till it is explicitly killed. I want to be able to deploy it in such a way that it continues to run even after I disconnect the USB cable from my Android device. When I try running the program like this,
$adb shell
<android_shell>$ /path/to/dir/myprog &
I am able to disconnect the cord and when I connect it back and do a
$ps | grep myprog
I can still see it running.
However, when I try running it this way,
$adb shell /path/to/dir/myprog &
the moment I disconnect my cord, the process is killed and I am not able to find it anymore with ps
.
1) What is the difference in these two ways of executing the command?
2) Is there a way I can run commands from the desktop terminal in a way to achieve what I'm trying to do?