IT Study/script

check storage

겸겸사 2016. 2. 19. 15:54

#!/bin/bash


### storage checking shell scripts ### 

# global variable

nfs_file_first=`/bin/df |grep -i 14.0.86.60`



# first storage checking

if [ "$nfs_file_first" == "" ]; then

echo "nfs mount is not confirmed.. start nfs mount"

/bin/mount -t nfs 14.0.86.60:/data /storage -o nolock,tcp,soft,noatime,nodiratime,rsize=16384,wsize=16384   

else

   echo "nfs mount is already done.."

fi


### 구성요소

# nfs 서버 확인

# nfs_file_first 가 null 이면 아래의 nfs mount 명령어 실행

# 해당값이 있으면 메시지 찍은후 if문 종료


### 해당 스크립트를 cron에 1분정도로 해서 필요한 서버에 걸어 놓으면 됨