mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
110 lines
3.0 KiB
Bash
Executable File
110 lines
3.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
################################################################################
|
|
# This file is part of OpenELEC - http://www.openelec.tv
|
|
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
|
#
|
|
# OpenELEC is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# OpenELEC is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
|
################################################################################
|
|
|
|
# create logfile
|
|
|
|
DATE=`date -u +%Y-%m-%d-%H.%M.%S`
|
|
BASEDIR="/tmp"
|
|
LOGDIR="log-$DATE"
|
|
RELEASE="`cat /etc/release`"
|
|
GIT="`cat /etc/issue |grep git`"
|
|
|
|
getlog_cmd() {
|
|
if which $1 >/dev/null; then
|
|
echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
echo "# ... output of $@" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
echo "# OpenELEC release: $RELEASE" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
echo "# $GIT" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
$@ >> $BASEDIR/$LOGDIR/$LOGFILE 2>/dev/null
|
|
echo "" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
fi
|
|
}
|
|
|
|
rm -rf $BASEDIR/$LOGDIR
|
|
mkdir -p $BASEDIR/$LOGDIR
|
|
|
|
# XBMC.log
|
|
LOGFILE="01_XBMC.log"
|
|
for i in `find /storage/.xbmc/temp/ -type f -name "*.log"`; do
|
|
getlog_cmd cat $i
|
|
done
|
|
|
|
# System.log
|
|
LOGFILE="02_System.log"
|
|
getlog_cmd dmesg
|
|
getlog_cmd lsmod
|
|
getlog_cmd ps xa
|
|
|
|
# Hardware.log
|
|
LOGFILE="03_Hardware.log"
|
|
getlog_cmd lspci -vvvvnn
|
|
getlog_cmd lsusb -vvv
|
|
getlog_cmd lsusb -t
|
|
getlog_cmd cat /proc/cpuinfo
|
|
|
|
# Audio.log
|
|
LOGFILE="04_Audio.log"
|
|
getlog_cmd aplay -l
|
|
getlog_cmd aplay -L
|
|
getlog_cmd amixer
|
|
|
|
# Network.log
|
|
LOGFILE="05_Network.log"
|
|
getlog_cmd ifconfig -a
|
|
getlog_cmd netstat -rn
|
|
getlog_cmd netstat -nalp
|
|
getlog_cmd connmanctl services
|
|
getlog_cmd cat /etc/resolv.conf
|
|
|
|
# varlog.log
|
|
LOGFILE="06_varlog.log"
|
|
for i in `find /var/log -type f`; do
|
|
getlog_cmd cat $i
|
|
done
|
|
|
|
# Input.log
|
|
LOGFILE="07_input.log"
|
|
getlog_cmd cat /proc/bus/input/devices
|
|
# make RPi users happy
|
|
if [ -e /proc/acpi/wakeup ] ; then
|
|
getlog_cmd cat /proc/acpi/wakeup
|
|
fi
|
|
|
|
# Filesystem.log
|
|
LOGFILE="08_Filesystem.log"
|
|
getlog_cmd cat /proc/mounts
|
|
getlog_cmd df -h
|
|
|
|
# Journal (current)
|
|
LOGFILE="09_Journal-cur.log"
|
|
getlog_cmd journalctl --no-pager -b -0
|
|
|
|
# Journal (prev)
|
|
LOGFILE="10_Journal-prev.log"
|
|
getlog_cmd journalctl --no-pager -b -1
|
|
|
|
# pack logfiles
|
|
mkdir -p /storage/logfiles
|
|
zip -jq /storage/logfiles/log-$DATE.zip $BASEDIR/$LOGDIR/*
|
|
|
|
# remove logdir
|
|
rm -rf $BASEDIR/$LOGDIR
|