Something Different In Linux

Home » How to » script to check NFS mount point

How to check NFS mount point by using the script ?

Ans : If you we have mounted the NFS directory one or  more servers and you want to monitor that mount point then you can use the following method.
1) Check the mount point directoy name, in the following example the mount directory name is NEWFTPFOLDER

[root@Server]# df
Filesystem 1K-blocks Used Available Use% Mounted on
14225776 2419848 11076636 18% /
tmpfs 1960568 0 1960568 0% /dev/shm
/dev/xvda1 487652 70084 391968 16% /boot
/dev/xvdf 206293688 1224268 194583660 1% /home/NEWFTPFOLDER

2) Create one file and add the following code with replaing the mount folder name and email address and save that file.

[root@Server]# cat /root/
HOSTNM=`hostname -i`
DATE=$(date +"%d-%b-%y %H:%M")
SHORTNAME="FileSystem Mount"
#Checking Filesytem Test
df -k | grep NEWFTPFOLDER
if [ $? == "1" ]
echo $LONGNAME is not running on $HOSTNM please investigate. Sent by myscript $DATE | mail -s "$SHORTNAME is not accessible"
exit 1

3) Set the cron every 30 minutes to check the mount point
[root@SingaporeExfoFtpServer cron.daily]# crontab -l
*/30 * * * * sh /root/

After that if the server is rebooted and mount point is not mount then it send the email to your email address.

Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...