Mount point

M

Mduduzijnr

Guest
Good day everyone

kindly assist I`m new on the Linux o/s and i have been given a task to have or write a script to check if mount points on our Linux server are available as we getting an alert every time. My aim is to have a script that will check every second and if the mount is there and it should do nothing but when the mount is in a stale file handle it should umount and mount it back.

i have come up with this so far.
#!/bin/bash
read -r -t1 < <(stat -t "/opt/hcap/storage")
if [ $? -eq 1 ]; then
echo NFS mount stale. Removing...
umount -f -l /opt/hcap/storage
fi
 


Welcome to the forums!

I'm afraid I am not a programmer, so I cannot help you much. But I did wonder about your location of "/opt/hcap/storage" in your script. I do not have a /opt/hcap in my Linux, and I can't understand how that location helps with mount points.

Issuing a mount command by itself will show many things mounted... probably more that you are looking for. Issuing a blkid command shows me a better summary of what my system is using. Viewing the /etc/fstab file will also show mount points that are established there.

Good luck!
 
the /hcap/storage mount point is provided by Isolion as an nfs mount and yes its on the /etc/fstab but time and time the mount point stale file handle and get an alert from zabbix stating the mount is unavailable. on which i have to umount and mount it back. my aim is to have a script that will run every 2-5 seconds to check if the mount is still available an if its there it should just pass a (0) output and if the mount is "stale file handle" the script should run to unmount and remount without me logging on the server and do that manually
 


Top