Created
September 26, 2014 20:58
-
-
Save wesleyit/bf6558b6653d702ad33d to your computer and use it in GitHub Desktop.
Run this script to capture the logs of all Android devices connected via ADB.
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
#!/bin/bash | |
# ########################################################## | |
# logcatch_them_all.sh | |
# Run this script to capture the logs of all Android | |
# devices connected via ADB. | |
# Wesley Rodrigues da Silva <wesley.it at gmail.com> | |
# LICENCE CREATIVE COMMONS BY - 2014 | |
# http://creativecommons.org/licenses/by/2.0/legalcode | |
# ######################################################## | |
## If running inside Jenkins, will use the default | |
# workspace, else, will create a folder in /tmp. | |
if [ -z "$WORKSPACE" ] | |
then | |
export WORKSPACE="/tmp/logcat/" | |
mkdir -p "$WORKSPACE" | |
fi | |
## List all adb devices and get each log in a file with | |
# the device name. | |
for device in $(adb devices | grep "device$" | cut -f 1) | |
do | |
mkdir -p "$WORKSPACE/logcats/" &> /dev/null | |
adb -s "$device" logcat -d > "$WORKSPACE/logcats/$device.log" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment