hw-test/scripts/scan-dmidecode

28 lines
757 B
Bash
Executable file

#!/bin/bash
#SERVER_SERIAL=`dmidecode -s chassis-serial-number | sed 's/\s.*$//'`
SERVER_SERIAL=`dmidecode -s system-serial-number | sed 's/\s.*$//'`
MY_DATETIME=`date +%Y-%m-%d_%H-%M-%S`
OUTPUT_HOME=/output/hwtests
OUTPUT_DIR=$OUTPUT_HOME/$SERVER_SERIAL
#OUTPUT_BAD="$OUTPUT_HOME/<BAD"
SNAPSHOT_D=$OUTPUT_HOME/snapshot/$SERVER_SERIAL/$MY_DATETIME
#if [[ -d $OUTPUT_BAD ]] ; then
# if [[ -f $OUTPUT_BAD/dmidecode ]] ; then
# IS_MY_SERIAL=`cat $OUTPUT_BAD/dmidecode | grep $SERVER_SERIAL`
# if [[ -n $IS_MY_SERIAL ]] ; then
# mv -vf $OUTPUT_BAD $OUTPUT_DIR
# fi
# fi
#fi
export SERVER_SERIAL
export OUTPUT_DIR
export SNAPSHOT_D
export MY_DATETIME
mkdir -p $OUTPUT_DIR
if [[ ! -f $OUTPUT_DIR/dmidecode ]] ; then
dmidecode > $OUTPUT_DIR/dmidecode
fi