M4FWCOREDUMP: add management of historic
Change-Id: I6000c931a0fa21a5cb636b8632120a8ec031a895 Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
This commit is contained in:
parent
2ea5422f29
commit
e388d7efd3
|
|
@ -1,7 +1,29 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
mkdir -p /var/crash
|
counter=1
|
||||||
|
DIRECTORY=/var/crash
|
||||||
|
DEPTH=5
|
||||||
|
|
||||||
|
mkdir -p "$DIRECTORY"
|
||||||
|
cd ${DIRECTORY}
|
||||||
|
|
||||||
|
MAX_HISTORIC=$(ls -1 | wc -l)
|
||||||
|
if [ $MAX_HISTORIC -gt $DEPTH ];
|
||||||
|
then
|
||||||
|
#cleanup history
|
||||||
|
ls -1 | sort -g | head -n $(($MAX_HISTORIC -$DEPTH +1)) | xargs --no-run-if-empty rm
|
||||||
|
fi
|
||||||
|
|
||||||
|
#get counter value
|
||||||
|
count=`ls -1 | sort -g | tail -n 1 | cut -d '_' -f 1`
|
||||||
|
count=$(($count + 1))
|
||||||
|
|
||||||
|
#register new dump
|
||||||
timestamp=$(date +%F_%H-%M-%S)
|
timestamp=$(date +%F_%H-%M-%S)
|
||||||
filename=/var/crash/m4-fw-error_${timestamp}.dump
|
filename=${count}_m4-fw-error_${timestamp}.dump
|
||||||
cat /sys/${DEVPATH}/data > ${filename}
|
cat /sys/${DEVPATH}/data > ${filename}
|
||||||
echo 1 > /sys/${DEVPATH}/data
|
echo 1 > /sys/${DEVPATH}/data
|
||||||
|
|
||||||
|
# synchronize filesystem
|
||||||
|
sync
|
||||||
|
cd -
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue