#!/bin/bash # produce lshw output and upload to lshw.si.hpc.lsu.edu dest='lshw.si.hpc.lsu.edu' pth='/tmp/lshw' date=$(date +%Y%m%d) ## init ##figure out fqdn if we can hostname=$(uname -n) ## make sure hostname is fqdn (why does this have to be this hard) hnlen=${#hostname} tmp=${hostname:nhlen-3:3} if [[ 'Xedu' != "X${tmp}" && 'Xorg' != "X${tmp}" ]] then hostname="${hostname}.hpc.lsu.edu" fi # deal with name (and lack of fqdn on some nodes) ## init next chunk of code generates a xymon error message if lshw is not installed. XYMON='client/bin/xymon' XYMONSERVER='xymon.hpc.lsu.edu' # if lshw is not installed, tell xymon and exit installed=$(rpm -q lshw | grep 'not installed' | wc -l) if ((0 < installed)) then if [[ -e ~xymon/${XYMON} ]] then echo "~xymon/${XYMON} ${XYMONSERVER} \"status ${hostname}.rpm-missing red ${date} lshw not installed\"" ~xymon/${XYMON} ${XYMONSERVER} "status ${hostname}.rpm-missing red ${date} lshw not installed" fi exit fi # end error code if [[ ! -d ${pth} ]] then # echo mkdir ${pth} mkdir ${pth} fi rm -f ${pth}/* lshw -quiet > ${pth}/${hostname}-full.txt lshw -quiet -short > ${pth}/${hostname}-short.txt lshw -quiet -businfo > ${pth}/${hostname}-businfo.txt lshw -quiet -xml > ${pth}/${hostname}.xml lshw -quiet -html > ${pth}/${hostname}.html echo rsync -avr -4 ${pth}/* rsync://${dest}/lshw-${hostname}/ rsync -avr -4 ${pth}/* rsync://${dest}/lshw-${hostname}/ rm -f ${pth}/*