[7e161ea] | 1 | #!/bin/sh
|
---|
| 2 | ########################################################################
|
---|
| 3 | #
|
---|
| 4 | # Description : show_event_log
|
---|
| 5 | #
|
---|
| 6 | # Authors : Based on Open Suse Udev Rules
|
---|
| 7 | # kay.sievers@suse.de
|
---|
| 8 | #
|
---|
| 9 | # Adapted to : Jim Gifford
|
---|
| 10 | # LFS
|
---|
| 11 | #
|
---|
| 12 | # Version : 00.00
|
---|
| 13 | #
|
---|
| 14 | # Notes :
|
---|
| 15 | #
|
---|
| 16 | ########################################################################
|
---|
| 17 | #
|
---|
| 18 | # known events are:
|
---|
| 19 | # ac97 acpi block cpu drivers edd firmware graphics i2c-adapter i8259
|
---|
| 20 | # ieee1394_protocol input ioapic irqrouter lapic mem misc module namespace
|
---|
| 21 | # pci_bus pci_express pcmcia pcmcia_socket platform pnp printer scsi scsi_host
|
---|
| 22 | # serio sound timer timer_pit tty usb usb_device usb_host vc
|
---|
| 23 | #
|
---|
| 24 | EXCLUDE_SUBS="acpi cpu edd mem namespace pci_bus tty vc"
|
---|
| 25 | # EXCLUDE_SUBS="ac97 acpi cpu drivers edd graphics i2c-adapter mem i8259 ioapic irqrouter lapic mem module namespace platform pnp pci_bus tty vc"
|
---|
| 26 | MESSAGES=${MESSAGES:-/var/log/messages}
|
---|
| 27 | #grep udevd /var/log/messages | grep -v "pass_env\|geventrec\|hal.hot\|received"
|
---|
| 28 |
|
---|
| 29 | show_event() {
|
---|
| 30 | local SN PID SUBS
|
---|
| 31 | declare -i SN=$1 PID
|
---|
| 32 | # read PID ACT SUBS < <(sed -n "s/^.*seq $SN forked, pid \[\([0-9]*\)\], \([^,]*\),.*$/\1 \2/p;T;q" $MESSAGES)
|
---|
| 33 | read PID ACT SUBS < <(sed -n "s/^.*seq $SN forked, pid \[\([0-9]*\)\], '\([^']*\)' '\([^']*\)'.*$/\1 \2 \3/p;T;q" $MESSAGES)
|
---|
| 34 | if [ $PID == 0 ] ; then
|
---|
| 35 | echo event $SN not found 1>&2
|
---|
| 36 | return 1
|
---|
| 37 | fi
|
---|
| 38 | if [ -n "$WANTED_SUBS" ] ; then
|
---|
| 39 | WANTED=no
|
---|
| 40 | for S in $WANTED_SUBS; do
|
---|
| 41 | test "$SUBS" == "$S" && WANTED=yes
|
---|
| 42 | done
|
---|
| 43 | else
|
---|
| 44 | WANTED=yes
|
---|
| 45 | for S in $EXCLUDE_SUBS; do
|
---|
| 46 | test "$SUBS" == "$S" && WANTED=no
|
---|
| 47 | done
|
---|
| 48 | fi
|
---|
| 49 | echo event $SN $PID $ACT $SUBS $WANTED 1>&2
|
---|
| 50 | test $WANTED == no && return 1
|
---|
| 51 | echo " _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $SN _ $ACT _ $SUBS _ _ _ _"
|
---|
| 52 | grep "seq $SN \|\[$PID\]" $MESSAGES |
|
---|
| 53 | grep -v "pass_env\|geventrec\|hal.hot"
|
---|
| 54 | echo
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | declare -i START=$1 STOP=$2
|
---|
| 58 | if [ "$2" == last ] ; then
|
---|
| 59 | read STOP < <(grep -o "udev_done.*exit" $MESSAGES | cut -d" " -f3 | sort -n | tail -1)
|
---|
| 60 | fi
|
---|
| 61 | test $START -lt 0 -a $STOP -gt 0 && START=$((STOP+START+1))
|
---|
| 62 | test $START -gt $STOP && STOP=$START
|
---|
| 63 | shift; shift; WANTED_SUBS="$*"
|
---|
| 64 | for n in `seq $START $STOP`; do
|
---|
| 65 | show_event $n
|
---|
| 66 | done
|
---|
| 67 |
|
---|
| 68 | exit
|
---|
| 69 |
|
---|
| 70 | # list all events
|
---|
[103e3eb] | 71 | (read x; while read x s x x x c x; read x s2 x a d; do echo $s $s2 $a $c $d; done) < <( sed -n "s/^.*udev.*\(seq [0-9]* [qf].*$\)/\1/p" /var/log/messages | sort -n -k 2 | tr -d ',' )
|
---|
[7e161ea] | 72 |
|
---|
| 73 | ./show_event_log 1 last > boot.events.log.`date +%A_%H:%M` 2> boot.events.list.`date +%A_%H:%M`
|
---|