#!/bin/bash
#
# System Event Log (SEL) dump program for mcinfo extension.
#
# Author:       Haruo Tomita <haruo.tomita@toshiba.co.jp>
#
# This program 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.
#
# (c) 2009 Copyright TOSHIBA Corporation. All rights reserved.

#MCINFO="/usr/sbin/mcinfo"


# Source mcinfo function library.
. /etc/mcinfo.d/functions

IPMIDEV=`ls -d /dev/ipmi* 2> /dev/null`
if [ -f /usr/bin/ipmitool ] && [ "$IPMIDEV" != "" ]; then
	DATE=`date +%Y-%m%d-%H%M-%S`
	SEL_FILE="/var/log/sel"

	/usr/bin/ipmitool sel writeraw $SEL_FILE-$DATE.log \
		> /dev/null 2>&1

	for f in /var/log/sel-*.log; do
		do_cp "$f"
	done
fi