Mounting NFS Shares on Solaris

Here's one tip for mounting NFS shares on Solaris that you may be able to adapt (keep in mind that Solaris calls the fstab vfstab, its standard response to ping requests, and the like): 

#!/bin/sh 

SIGN=0 

mount | grep ":/" | nawk '{ print $1,$2,$3 }' | sort 

>>/tmp/nfs_list.txt 

for i in `grep nfs /etc/vfstab | egrep -v "^#" | nawk '{ print $3 

"*on*" $1 }' | sort`; do 

JJ=`echo "$i" | sed -e 's/\*/ /g` 

MNT_TRY=`echo "$JJ" | nawk '{ print $1 }'` 

SRVR=`echo "$JJ" | nawk '{ print $3 }' | nawk '{ FS=":"; 

print $1 }'` 

CK_MNT=`egrep -c "$JJ" /tmp/nfs_list.txt` 

if [ $CK_MNT -lt 1 ]; then 

echo "NO MOUNT: $JJ" 

PINGIT=`/usr/sbin/ping $SRVR 1 | grep -c "alive"` 

if [ "$PINGIT" = "1" ]; then 

mount $MNT_TRY 

CHK2=$? 

if [ $CHK2 -ne 0 ]; then 

echo "FAILED: 2nd mount attempt for $JJ--Check 

availability!" 

else 

echo "SUCCESS: Mount Attempt for $JJ" 

fi 

else 

echo "Mount source $SRVR: no response to ping!" 

echo "FAILED: mount attempt for $JJ!" 

fi 

SIGN=1 

else 

CK_STALE=`ls -l $MNT_TRY` 

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

umount -f $MNT_TRY 

PINGIT=`/usr/sbin/ping $SRVR 1 | grep -c "alive"` 

if [ "$PINGIT" = "1" ]; then 

mount $MNT_TRY 

CHK2=$? 

if [ $CHK2 -ne 0 ]; then 

echo "FAILED: Mount attempt for stale $JJ--Check 

availability!" 

else 

echo "SUCCESS: Remount attempt for stale $JJ" 

fi 

else 

echo "Mount source $SRVR: no response to ping!" 

echo "FAILED: mount attempt for $JJ!" 

fi 

SIGN=1 

fi 

fi 

done 

if [ $SIGN -eq 0 ]; then 

echo "All /etc/vfstab NFS Mounts O.K." 

else 

echo "\n/etc/vfstab NFS mounts O.K. except as marked 

'FAILED' above" 

fi 

rm -f /tmp/nfs_list.txt 

Linux Tips

See Also
Examples Of Netfilter Port Forwarding

Have a Linux Problem
Linux Forum - Do you have a Linux Question?

Linux Books
Linux Certification, System Administration, Programming, Networking Books

Home Index
Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.