Categories
GNU/Linux

GNU/Linux Auto-mount NFS Share

Bash script to auto-mount NFS share when it is available (and not already mounted).

#!/bin/bash
ping -c 1 -n 192.168.1.250 > /dev/null
if [ $? -eq 0 ] && [ ! -d /mnt/nas1/directory ]; then
 sudo mount -t nfs 192.168.1.250:/mnt/nfsmountpoint /mnt/nas1
fi