
#!/bin/sh
# File  : cmd_filers_vfilers.sh
# By    : Maarten.DeBoer@Atos.net, 140827
# Subject       : A cmd-script to send some command to all filers & vfilers
PGM="`basename $0|cut -d\. -f1`"
TMP="/tmp/${PGM}.$$.asc"
LOG="${HOME}/log/${PGM}.log"
FILERS="${HOME}/etc/filers"
SSH="/usr/bin/ssh -n"
MAILTO="maarten.deboer@atos.net"

touch ${TMP}

for FILER in `cat ${FILERS}|grep -v \^#|sort`
do
  ${SSH} ${FILER} vfiler status|grep running|grep -v vfiler0|awk '{print $1}'| while read VFILER
  do
    echo "${FILER}/${VFILER}:"|tee -a ${TMP}

    ${SSH} ${FILER} vfiler run ${VFILER} fpolicy show Varonis|tee -a ${TMP}

  done  #VFILER
done  # FILER

date|mailx -a ${TMP} -s "${PGM}" ${MAILTO}

rm ${TMP}
exit 0

