summaryrefslogtreecommitdiff
path: root/scripts/checksel
blob: 63ea9a912550cc73c4bfe85bcec1362713ffcfaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
#
# checksel
#
# This script runs ipmiutil sel, writing any new records to syslog, 
# and will then clear the SEL if free space is low.
#
# The IPMI SEL should not normally be cleared, because the history
# of the events is important, but if the IPMI SEL fills up, no new
# events are logged, so saving the previous SEL events and clearing
# the SEL must be done occasionally, as needed.
#
# app=`basename $0`
# pdir=`echo $0 |sed -e "s/$app//"`
pdir=/usr/bin
ddir=/var/lib/ipmiutil
# First check to see if the IPMI SEL is enabled on this system.
# If not, do nothing else.
$pdir/ipmiutil sel -v >/dev/null 2>&1
if [ $? -eq 0 ]; then
  # Write new SEL events to syslog, and check if free space is low
  $pdir/ipmiutil sel -w |grep "WARNING: free space" 
  if [ $? -eq 0 ]; then
     today=`date +%y%m%d`
     # The old SEL records are in syslog, but save a copy in $ddir also.
     $pdir/ipmiutil sel -e >$ddir/ipmisel_${today}.txt
     # Clear the IPMI SEL
     $pdir/ipmiutil sel -d
  fi
fi