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
/dev/mapper/VolGroup-lv_root
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 checkmountpoint.sh and add the following code with replaing the mount folder name and email address and save that file.

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

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

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


Vishwajit Kale
Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.

Recent Posts

The Ultimate Guide to WordPress Maintenance: Tips and Tricks

When you’re running a business that relies on website traffic and sales to succeed. Then you need to keep it…

1 week ago

Migrate In 2024: Our Comprehensive Website Migration Manual to the Next Level

Migration! Yes, this word is very big in the web hosting industry and it has its importance. Especially for businesses…

1 week ago

Unveiling the Importance of Server Maintenance Plans: A Comprehensive Guide

The server is the backbone of the web hosting industry and it acts like a HERO in the web hosting…

2 weeks ago

IP Address is Blocked? A handpicked list of Solutions to Fix it?

Imagine you are on holiday having a cup of tea and browsing your website or blog.Then, what next?You will get…

3 weeks ago

Explained: Difference between Nameservers Vs. DNS

The web hosting industry is growing every minute, day, and year. It has many terminologies that are important to understand…

1 month ago