Skip to content

Instantly share code, notes, and snippets.

@bageljp
Created February 13, 2014 07:13
Show Gist options
  • Save bageljp/8971096 to your computer and use it in GitHub Desktop.
Save bageljp/8971096 to your computer and use it in GitHub Desktop.
mount check
#!/bin/bash
FL_CHECK=".health_check.html.`hostname`"
MESSAGE=""
LIST_MOUNT[0]="/var/www/html/contents"
ret=0
flg_err=0
for i in ${LIST_MOUNT[@]}; do
rm -f "${i}/${FL_CHECK}"
echo "`date +'%Y/%m/%d %H:%M:%S'` `hostname`" > "${i}/${FL_CHECK}"
ret=$?
if [ ${ret} -eq 0 ]; then
MESSAGE=`echo -e "${MESSAGE} \n${i} : OK"`
else
MESSAGE=`echo -e "${MESSAGE} \n${i} : ERROR"`
flg_err=1
fi
done
if [ ${flg_err} -eq 0 ]; then
echo -e "mountpoint check is ALL OK.${MESSAGE}"
exit 0
else
echo -e "mountpoint check is ERROR.${MESSAGE}"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment