mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-02 23:44:37 +01:00
crashlog: catch and store any code dump file.
store the core on the crashlog server.
This commit is contained in:
parent
37246891bb
commit
c9f8a17880
4 changed files with 63 additions and 3 deletions
|
|
@ -16,7 +16,7 @@ PKG_RELEASE:=1
|
|||
PKG_SOURCE_URL:=git@iopsys.inteno.se:bcmkernel-4.16L.03
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
PKG_SOURCE_VERSION:=c6cd2eb6b194e5a387949f59cbb1d754686e97ea
|
||||
PKG_SOURCE_VERSION:=18d21ddf30d920cb8e6d2e9dd073ed10903deb20
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_SDK_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
endif
|
||||
|
||||
|
|
|
|||
11
crashlog/files/etc/init.d/corelog
Executable file
11
crashlog/files/etc/init.d/corelog
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=01
|
||||
|
||||
start()
|
||||
{
|
||||
if [ -e /proc/sys/kernel/core_pattern ]
|
||||
then
|
||||
echo "|/sbin/logcore %e %s" > /proc/sys/kernel/core_pattern
|
||||
fi
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ send_log()
|
|||
hwv=$(db get hw.board.hardwareVersion)
|
||||
bid=$(db get hw.board.boardId)
|
||||
sw=$(db get hw.board.iopVersion)
|
||||
server=$(/sbin/uci get system.cashlog.server)
|
||||
server=$(/sbin/uci get system.crashlog.server)
|
||||
|
||||
while true
|
||||
do
|
||||
|
|
@ -26,7 +26,7 @@ send_log()
|
|||
boot()
|
||||
{
|
||||
# is crashlog enabled ?
|
||||
enable=$(/sbin/uci get system.cashlog.enable)
|
||||
enable=$(/sbin/uci get system.crashlog.enable)
|
||||
case $enable in
|
||||
0|no|NO|false|FALSE)
|
||||
exit 0
|
||||
|
|
|
|||
49
crashlog/files/sbin/logcore
Executable file
49
crashlog/files/sbin/logcore
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#! /bin/sh
|
||||
|
||||
TMP_CORE=/tmp/new_core
|
||||
# first test if we can contact the log server.
|
||||
# if not abort directly the core file takes up memory
|
||||
alive()
|
||||
{
|
||||
ping -c1 $server
|
||||
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
# drain core file from kernel
|
||||
cat >/dev/null
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# is corelog enabled ?
|
||||
enable=$(/sbin/uci get system.corelog.enable)
|
||||
case $enable in
|
||||
0|no|NO|false|FALSE|"")
|
||||
# drain core file from kernel
|
||||
cat >/dev/null
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
server=$(/sbin/uci get system.corelog.server)
|
||||
|
||||
alive
|
||||
|
||||
# dump out the core to disk we need this as scp needs a size before we send data
|
||||
# and this is the only way to know how much data there is
|
||||
cat >$TMP_CORE
|
||||
|
||||
# in case filesystem/memory is full at least kill the core in the kernel memory should give us some
|
||||
# more memory to work with. normally this would do nothing.
|
||||
cat >/dev/null
|
||||
|
||||
nr=$(db get hw.board.serialNumber)
|
||||
hw=$(db get hw.board.hardware)
|
||||
hwv=$(db get hw.board.hardwareVersion)
|
||||
bid=$(db get hw.board.boardId)
|
||||
sw=$(db get hw.board.iopVersion)
|
||||
|
||||
scp -S /usr/sbin/logssh $TMP_CORE log@${server}:log/core_${1}_${2}_${bid}_${hwv}_${hw}_${sw}_${nr}
|
||||
rm $TMP_CORE
|
||||
|
||||
Loading…
Add table
Reference in a new issue