一个抓取系统多用户相关信息的脚本。
此处shell包含while循环,变量运算,返回值赋值。
count=1;
while((count>=1))
do
adb logcat -b all >logcat.txt &
time=`adb shell date +%Y-%m-%d_%H-%M-%S`
echo "time:${time}"
echo "----------------collect start, cycle-${count}, time:${time}----------------"
mkdir collected_data_${count}_${time}
adb shell ps -ef |tee ./collected_data_${count}_${time}/ps${count}.txt
adb shell top -n 3 -s 10 -m 200 |tee ./collected_data_${count}_${time}/top${count}.txt
adb shell pm list users |tee ./collected_data_${count}_${time}/pm_list_users${count}.txt
adb shell dumpsys meminfo |tee ./collected_data_${count}_${time}/dumpsys_meminfo${count}.txt
echo "----------------collect end, cycle-${count}, time:${time}----------------"
echo " "
sleep 5
let "count++"
done