3bab2a9096
Signed-off-by: LawrenceSY_Kuo@asus.com Bug: 19608716 Change-Id: I90e0313262a02906dec71417b995fc725f78a292
42 lines
1,012 B
Bash
Executable file
42 lines
1,012 B
Bash
Executable file
#! /system/bin/sh
|
|
# logpersist cat start and stop handlers
|
|
progname="${0##*/}"
|
|
case `getprop ro.build.type` in
|
|
userdebug|eng) ;;
|
|
*) echo "${progname} - Permission denied"
|
|
exit 1
|
|
;;
|
|
esac
|
|
data=/data/misc/logd
|
|
property=persist.logd.logpersistd
|
|
service=logcatd
|
|
if [ X"${1}" = X"-h" -o X"${1}" = X"--help" ]; then
|
|
echo "${progname%.*}.cat - dump current ${service%d} logs"
|
|
echo "${progname%.*}.start - start ${service} service"
|
|
echo "${progname%.*}.stop [--clear] - stop ${service} service"
|
|
exit 0
|
|
fi
|
|
case ${progname} in
|
|
*.cat)
|
|
su 1036 ls "${data}" |
|
|
tr -d '\r' |
|
|
sort -ru |
|
|
sed "s#^#${data}/#" |
|
|
su 1036 xargs cat
|
|
;;
|
|
*.start)
|
|
su 0 setprop ${property} ${service}
|
|
getprop ${property}
|
|
sleep 1
|
|
ps -t | grep "${data##*/}.*${service%d}"
|
|
;;
|
|
*.stop)
|
|
su 0 stop ${service}
|
|
su 0 setprop ${property} ""
|
|
[ X"${1}" != X"-c" -a X"${1}" != X"--clear" ] ||
|
|
( sleep 1 ; su 1036,9998 rm -rf "${data}" )
|
|
;;
|
|
*)
|
|
echo "Unexpected command ${0##*/} ${@}" >&2
|
|
exit 1
|
|
esac
|