0

I have two c application running on android say helloWorld and helloHell . I need to run both but with a reboot in between. I have adb pushed the applications to a folder in android file system and created two scripts :

helloworld.sh and helloHell.sh 

inside helloworld.sh : 
 ./helloworld
  reboot

inside helloHell.sh  : 
 ./helloHell
  reboot

I have written a shell script on the host PC like this :

hell-world.sh



1->adb shell sh helloWorld.sh
2->some calculated delay
3->adb shell sh helloHell.sh

But the problem with this is after running first script (1->) the command hangs(may be due to reboot inside the helloworld.sh) and I have to manually do CTRL+C , and then manually run the second script(2->) once the reboot is over. I even tried killing after the first script execution(1->) by doing something like this

PID =$!
kill -9 $PID

but invain,

My aim is to run both the applications with a reboot in between with no user intervention in between.The problem here is after the reboot no new command after that will be executed and have to terminate it manually.

Raulp
  • 7,758
  • 20
  • 93
  • 155
  • periodically check if your device is available, using `adb devices`. After the device becomes available again, wait for a while if you want & continue further commands. – anishsane Apr 20 '15 at 11:39
  • the problem is even before device becoming available after reboot.That is the terminal windows doenst returns to next line and remains in hang state until I Press CTRL+C which I wants to avoid. – Raulp Apr 20 '15 at 11:41
  • 1
    This will help you for the `wait for a while` part in above comment: http://stackoverflow.com/questions/13091035/adb-receive-broadcast-boot-complete – anishsane Apr 20 '15 at 11:42

1 Answers1

-1

Remove reboot from script file & try this

adb shell sh helloWorld.sh
adb shell reboot
# add some delay here
adb shell sh helloHell.sh
Don Chakkappan
  • 7,397
  • 5
  • 44
  • 59
  • if I put everything in a script as you said the prompt will never come after reboot and I have to manually do CTRL+C which I dont want. – Raulp Apr 21 '15 at 04:55