[android] Restart android machine

we have android + linux m/c, we log in into linux shell and boot the machine in android GUI. now we have the some script that is running on the same machine through linux shell. In that case when the script hangs we need to restart android machine. but it result into restarting the linux machine too. as they are on same machine. so i need the way to restart the android so it comes out of hang state and control remains on the script that is running through the linux shell.

so is there any adb or linux command that work for me?

This question is related to android adb android-source

The answer is


I think the only way to do this is to run another machine in parallel and use that machine to issue commands to your android box similar to how you would with a phone. If you have issues with the IP changing you can reserve an ip on your router and have the machine grab that one instead of asking the routers DHCP for one. This way you can ping the machine and figure out if it's done rebooting to continue the script.


adb reboot should not reboot your linux box.

But in any case, you can redirect the command to a specific adb device using adb -s <device_id> command , where

Device ID can be obtained from the command adb devices
command in this case is reboot


Have you tried simply 'reboot' with adb?

  adb reboot

Also you can run complete shell scripts (e.g. to reboot your emulator) via adb:

 adb shell <command>

The official docs can be found here.