#!/bin/bash domain=$(hostname|awk -F "-" '{print$1}') case ${domain} in "d1") check_mounts=$(echo " /data/mnt/glusterfs/cnlu_center_vol /data/mnt/glusterfs/cnlu_branch_vol ") ;; "d2") check_mounts=$(echo " /data/mnt/glusterfs/casr_23rd_branch_vol /data/mnt/glusterfs/lasr_branch_vol /data/mnt/glusterfs/casr_4rd_branch_vol ") ;; "d3") check_mounts=$(echo " /data/mnt/glusterfs/lasr_center_vol /data/mnt/glusterfs/lasr_branch_vol /data/mnt/glusterfs/casr_23rd_center_vol /data/mnt/glusterfs/casr_23rd_branch_vol /data/mnt/glusterfs/casr_4rd_center_vol /data/mnt/glusterfs/casr_4rd_branch_vol ") ;; esac process_info=`ps -elf|grep glusterfs|grep "process-name fuse"|awk '{print$NF}'` df_info=`cat /proc/mounts |grep glusterfs|awk '{print$2}'` for i in ${check_mounts}; do mount_point=${i} ret=1 for p in $process_info; do if [ $p == "$mount_point" ]; then ret=0 fi done if [ $ret -eq 1 ]; then echo "glusterfs_mount_point_check{mount_point=\"$mount_point\"} $ret" continue; fi ret=1 for df in $df_info; do if [ $df == "$mount_point" ]; then ret=0 fi done if [ $ret -eq 1 ]; then mount $mount_point > /dev/null 2>&1 fi echo "glusterfs_mount_point_check{mount_point=\"$mount_point\"} $ret" done