
#!/bin/sh
# File  : get_sysconfigs.sh
# By    : Maarten.DeBoer@Atos.net, 170425
# Subject       : A script to get sysconfigs oa all FILERs
PGM="`basename $0|cut -d\. -f1`"
VER="0.1"
TMP="/tmp/${PGM}.$$.asc"
LOG="${HOME}/log/${PGM}.log"
FILERS="${HOME}/etc/filers"
SSH="/usr/bin/ssh -n"
MAILTO="maarten.deboer@atos.net"
ASC="${PGM}.asc"
HOSTNAME="`hostname | cut -d\. -f1`"

touch ${TMP}

for FILER in `cat ${FILERS}|grep -v \^#`
do
  ASC="${FILER}_sysconfig.asc"

  echo "${FILER} sysconfig -a :"|tee -a ${TMP}
  ${SSH} ${FILER} 'sysconfig -a' >> ${TMP}
  echo ""|tee -a ${TMP}
  echo "${FILER} sysconfig -d :"|tee -a ${TMP}
  ${SSH} ${FILER} 'sysconfig -d' >> ${TMP}
  echo ""|tee -a ${TMP}
  echo "${FILER} sysconfig -h :"|tee -a ${TMP}
  ${SSH} ${FILER} 'sysconfig -h' >> ${TMP}
  echo ""|tee -a ${TMP}
  echo "${FILER} sysconfig -m :"|tee -a ${TMP}
  ${SSH} ${FILER} 'sysconfig -m' >> ${TMP}
  echo ""|tee -a ${TMP}
  echo "${FILER} sysconfig -r :"|tee -a ${TMP}
  ${SSH} ${FILER} 'sysconfig -r' >> ${TMP}
  echo ""|tee -a ${TMP}
  echo "${FILER} sysconfig -t :"|tee -a ${TMP}
  ${SSH} ${FILER} 'sysconfig -t' >> ${TMP}

  cp ${TMP} /tmp/${ASC}
  date | mailx -a /tmp/${ASC} -s ":${HOSTNAME}: sysconfig of ${FILER} [${PGM} v${VER}]" "${MAILTO}"
  cp /dev/null ${TMP}

done  # FILER


rm ${TMP}
exit 0

