AIX NFS Check


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting AIX NFS Check
# 1  
Old 10-02-2015
AIX NFS Check

Good day
On a AIX system I would like to see if a NFS mount is not set to auto mount, the desired output should be Mount name and Yes or NO.

My test environment has 3 NFS mounts of which only 1 is set to auto mount.
Code:
lsfs -v nfs | read -r Name Nodename Mount VFS Size Options Auto Accounting

if [ $Auto = no ]
then
    echo $Mount NO
else
    echo $Mount YES
fi

#output

Mount YES


My output does not show the mount name and seems to only read the first line

Thank you
Moderator's Comments:
Mod Comment please use for your code and data, code tags, thanks

Last edited by vbe; 10-02-2015 at 08:10 AM..
# 2  
Old 10-02-2015
The read from a pipe is executed in a subshell, and thus the varables read are lost when the subshell finishes. Neither Mount nor Auto are set within the if construct. I'd be surprised if your output really showed "Mount"
# 3  
Old 10-02-2015
You need a while loop!
Code:
lsfs -v nfs |
while read Name Nodename Mount VFS Size Options Auto Accounting
do
  if [ "$Auto" = no ]
  then
    echo "$Mount NO"
  else
    echo "$Mount YES"
  fi
done

To exclude the header line
Code:
lsfs -v nfs | {
read header
while read Name Nodename Mount VFS Size Options Auto Accounting
do
  if [ "$Auto" = no ]
  then
    echo "$Mount NO"
  else
    echo "$Mount YES"
  fi
done
}


Last edited by MadeInGermany; 10-02-2015 at 08:24 AM..
This User Gave Thanks to MadeInGermany For This Post:
# 4  
Old 10-02-2015
Thank you that works awesome
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

AIX NFS Server and NFS Client

Hi 2 ALL, try to run NFS Server in AIX 7.1 : 1. Step by step on NFS Server node mkdir /tmp/test chgrp staff /tmp/test chmod 775 /tmp/test-- create export directory (fs) mknfsexp -d /tmp/test -t ro exportfs -va show mount -e :/# exportfs -av exports: 1831-187 re-exported /tmp/test... (4 Replies)
Discussion started by: penchev
4 Replies

2. Shell Programming and Scripting

Hang NFS shell script check

Hello all, i wrote a shell script that was running perfectly fine until we had some issue with our NFS server and the script was hung. This script runs every 20 mins and obviously as we had the NFS issue, the script start to hang. as i do a check to make sure NFS directory is avaiable or not.... (7 Replies)
Discussion started by: crazy_max
7 Replies

3. AIX

NFs share AIX 6.1 and 5.3 - bug ? -

Hi folks, Just get my 1st AIX 6.1 servers up and creating some NFS shares without issues. I can mount it from others AIX 6.1 systems but can't from 5.3. Permissions etc. are OK lcppa1261 45: pbrun mount lcppa1001:/export/images /mnt NFS server lcppa1001 not responding still trying... (1 Reply)
Discussion started by: unclefab
1 Replies

4. UNIX for Dummies Questions & Answers

How to check whether file system is local or NFS?

Hi, suppose I have file system path say /foo/bar/baz then how would I find out whether it is local file system or NFS? If it is NFS then I want to find out the host where file system is located. Thanks, Paresh (5 Replies)
Discussion started by: masaniparesh
5 Replies

5. AIX

Using AIX HACMP and NFS together

Hi, need advice on this. Is it possible to assign a mountpoint from a SAN storage to server1 & server2. Use NFS to the same mountpoint from server2 so that concurrent access is allowed. Can this setup be used together with HACMP? If server1 crash, the mountpoint resource will swing to... (8 Replies)
Discussion started by: chongkls77
8 Replies

6. AIX

nfs on aix

Hi, I want to know how to configure nfs on aix, What changes are needs to be done nfs master and nfs client What are steps to share a directory and mouning on nfs client, Regards Manoj (1 Reply)
Discussion started by: manoj.solaris
1 Replies

7. HP-UX

Command for check NFS Server.

Please Help, What cammand use to check sharing path on NFS Server. Thanks, :cool: (2 Replies)
Discussion started by: arm_naja
2 Replies

8. Solaris

command for to check the connected cilents to NFS

Hi all, i want to know the command for to check the how many clients are connected to NFS server? regards Krishna (4 Replies)
Discussion started by: murthy76
4 Replies

9. UNIX for Advanced & Expert Users

NFS Mount Os400 to AIX

I am having an issue in one of my LPARs gettin a NFS mount between it, AIX and an Iseres LPAR, Os400. I get NFS Server xxxx not responding still trying. When I run the df commmand it says NFS Server xxxxx ok. Then shows the fs and then continiously puts out the about not responding error and the... (0 Replies)
Discussion started by: capeme
0 Replies

10. UNIX for Advanced & Expert Users

AIX, Netscape and NFS

Hi We have succesfully mounted a file system with NFS on another machine (that is running Netscape). When we look into this mount (with AIX) and we can see all the mounted files. All the rights etc. are ok but when we are working with Netscape we don't see any file? Is there a reasonable... (3 Replies)
Discussion started by: Mark Detrez
3 Replies
Login or Register to Ask a Question