loggy.sh android 1

loggy.sh android

#!/system/bin/sh
# loggy.sh.

#_date=`date +%F_%H-%M-%S`
logcat -b all -f  /cache/logcat_${_date}.txt &
dmesg -w > /cache/kmsg_${_date}.txt &

Here is what the above code is Doing:
1. It’s creating a file called loggy.sh in the /data/local/tmp directory.
2. It’s making the file executable.
3. It’s creating a variable called _date and setting it to the current date and time.
4. It’s starting a logcat process and writing the output to a file called logcat_${_date}.txt in the /cache directory.
5. It’s starting a dmesg process and writing the output to a file called kmsg_${_date}.txt in the /cache directory.

Now that we have our script, we need to run it. We can do this by running the following command:

$ adb shell sh /data/local/tmp/loggy.sh

This will start the logcat and dmesg processes and write the output to the files we specified.

Now that we have our log files, we can use the pull command to copy them to our local machine.

$ adb pull /cache/logcat_${_date}.txt
$ adb pull /cache/kmsg_${_date}.txt

Similar Posts