Created
June 16, 2020 17:30
-
-
Save umangshrestha/2995d037d7605449eb436df74aaaf7da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1. Place the script in the phone's internal storage. | |
#2.Give the command 'adb tcpip 5555' in the command line. This has to be given when the phone is connected to the laptop via usb cable. | |
#If successful, you will get the print "restarting in TCP mode port: 5555" | |
#3. Switch On the phone's hotspot and connect laptop to the hotspot. | |
#4. You can remove the usb cable now. | |
#5. Just check whether you can connect adb over tcpip by giving the below command. | |
#adb connect <ip of phone>:5555 | |
#6. Login to adb shell using command | |
#adb shell | |
#7. Go to the place where you have kept the script and run it using the below command. | |
#nice -n 19 sh batteryscript.sh & | |
#8. Now you can disconnect the laptop from the phone's hotspot. | |
#The script will run in the background and you will get the log in the file "batterystatus.txt" in the phone's storage. | |
#In some phones the command "nice -n -19 sh batteryscript.sh &" will get inactive after sometime and data won't be saved if the phone gets locked for a long duration. | |
#So if the batterystatus.txt file is not getting updated in any of the phones, try using the below command | |
#nohup sh batteryscript.sh </dev/null & | |
#And the output log will be saved in nohup.out. | |
while true | |
do | |
var=`date` | |
var1=`dumpsys battery | grep level` | |
echo "$var $var1" | |
sleep 180 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment