#!/bin/bash COLUMN=Lost+Found COLOR=green MSG="lost+found directory not empty" DATE=$(date) fslist=($( mount | egrep 'btrfs|reiserfs|ext|xfs' | awk '{print $3}' )) #get list of btrfs, reiserfs, ext, xfs filesystems fsnum=$(echo ${#fslist[@]}) #get number of filesystems present for (( i = 0; i < $fsnum; i++ )); do #iterate through each filesystem in the list fsname=$(echo ${fslist[i]}) #get fs name lffile_num=$(echo ls -1A $fslist[i]/lost+found | wc -l) #get number of files in /lost+found if [ lffile_num > 0 ] #test if /lost+found is empty then COLOR=red MSG="${MSG} echo The lost+found directory in filesystem $fsname is not empty else MSG="${MSG} lost+found directories empty " fi ${XYMON} ${XYMSRV} "status ${MACHINE}.${COLUMN} ${COLOR} ${DATE} ${MSG} " exit 0