LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-06-2011, 03:06 AM   #1
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Rep: Reputation: Disabled
how to get mounted IP address into text file


I am sharing directories using NFS.so one machine mounted those locations (Server). so i need to get what are the machine which successfully mounted (IP address of mounted locations).
At the boot time server mount the remote location.but i want to get what are the successfully mounted location into text file.

thanks,
 
Old 06-06-2011, 03:26 AM   #2
the_bigbalu
LQ Newbie
 
Registered: Jun 2011
Location: Bavaria
Distribution: Fedora 18, Ubuntu 12.04
Posts: 21

Rep: Reputation: Disabled
Usually, you can see it on /etc/mtab

i hope thats what you meant
 
Old 06-06-2011, 03:34 AM   #3
manyrootsofallevil
Member
 
Registered: Dec 2010
Distribution: Red Hat, Kubuntu
Posts: 130

Rep: Reputation: 14
Quote:
Originally Posted by hk_centos View Post
I am sharing directories using NFS.so one machine mounted those locations (Server). so i need to get what are the machine which successfully mounted (IP address of mounted locations).
At the boot time server mount the remote location.but i want to get what are the successfully mounted location into text file.

thanks,
From the NFS server you could run this, but according to the manual this is not reliable.

Code:
showmount -a > textfile
Thus, you are better off looking at the network connections

Code:
netstat -a | grep nfs > textfile
 
Old 06-08-2011, 03:02 AM   #4
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Original Poster
Rep: Reputation: Disabled
What is a mean about this error

when type a command
showmount -a

it will give a error message
mount clntudp_create:RPC:Program not registered

how can i solve this problem

thanks,
 
Old 06-08-2011, 03:11 AM   #5
venikathir
LQ Newbie
 
Registered: Apr 2011
Location: Bangalroe-India
Distribution: Redhat EL5
Posts: 24

Rep: Reputation: 1
u are not configured the NFS on ur machine.
check the machine NFS is running and configured then try showmount -e <server ip/name>

Regds
KVK
India
 
Old 06-08-2011, 03:22 AM   #6
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Original Poster
Rep: Reputation: Disabled
Unhappy

still i'm having same problem mates.

I'm unable to get machines IP's which were successfully mounted into NFS Client. Actually my NFS client work as distributor. he will store the data files among his NFS servers. NFS server only export his location to NFS client.(one NFS client and many NFS servers)

to store data files NFS client need to know what are the successfully mounted remote locations(NFS Servers).Because some NFS server machine can be in power off state. therefore i need to get success fully mounted NFS servers IP's

Please Help Me Friends,

thanks.
 
Old 06-08-2011, 03:26 AM   #7
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by venikathir View Post
u are not configured the NFS on ur machine.
check the machine NFS is running and configured then try showmount -e <server ip/name>

Regds
KVK
India
Dear KVK,

I restart nfs service like this
service nfs start
chkconfig nfs on

now it'sworking

still i'm unable to get IP's of successfully mounted machines

Thanks,
 
Old 06-09-2011, 02:53 AM   #8
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Original Poster
Rep: Reputation: Disabled
Unhappy How to run script just before shutdown/restart the LInux machine

Hey Guys,
I need to know how to run script just befor shutdown /restart the linux machine. actually what i want is pass the message to another machine saying I'm shutting down.

Please give sample script (specially mention how to set runlevels)

Thanks,
 
Old 06-09-2011, 03:22 AM   #9
manyrootsofallevil
Member
 
Registered: Dec 2010
Distribution: Red Hat, Kubuntu
Posts: 130

Rep: Reputation: 14
Quote:
Originally Posted by hk_centos View Post
still i'm having same problem mates.

I'm unable to get machines IP's which were successfully mounted into NFS Client. Actually my NFS client work as distributor. he will store the data files among his NFS servers. NFS server only export his location to NFS client.(one NFS client and many NFS servers)

to store data files NFS client need to know what are the successfully mounted remote locations(NFS Servers).Because some NFS server machine can be in power off state. therefore i need to get success fully mounted NFS servers IP's

Please Help Me Friends,

thanks.
I'm a bit confused, by this. You have 1 client and multiple servers?

The mount is initiated by the client, so if you have only one client, that is where you need to look, namely in the client. As pointed out before by the_bigbalu, you just need to look at /etc/mtab, which will tell you what is currently mounted at the moment by the server. You could also just run mount, which will tell you what file systems the client has mounted.

In order to run a script during shutdown, just place the script in /etc/rc.d/rc0.d (/etc/rc.d/rc6.d for reboot) and prepend Knn to the name of the script, where nn is a number that indicates the running order of the script if memory serves right.

To check whether a server is up, you could ping the host once ping <ip> -c 1 and parse the output to check whether it responds.

Hope this helps, but I'm not sure this is what you want.
 
Old 06-09-2011, 07:55 AM   #10
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Original Poster
Rep: Reputation: Disabled
Unhappy

i when i type
vi /etc/ftab | grep nfs
it shows all mounted point and location (by nfs) it is ok, but suddenly one machine can be down (power failure or any reasons).Then i'm unable to access that location.
again i typed same command and shows a same result. but actually one location is physically down. hw can i solve this problem.

PS: Are there any methods to restart mount location without restarting machine.(My server can't reboot it work as 24/7 )

hw to re-mount nfs location without restarting machine

thanks,
 
Old 06-10-2011, 02:31 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Code:
/etc/fstab
is just a wish list as far as the OS is concerned.
If you
Code:
cat /etc/mtab
that will tell you what is actually mounted, as will
Code:
df -h
You can use the mount cmd to mount a specific drive; http://linux.die.net/man/8/mount. Use the -a switch to (attempt to) mount everything mentioned in /etc/fstab.
 
1 members found this post helpful.
Old 06-10-2011, 04:12 AM   #12
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Original Poster
Rep: Reputation: Disabled
Unhappy

Dear Chris,

Thank you for your kind assistant.

df -h

list down all actually mounted location. in a situation mounted location can be unavailable (power failure). still df -h provide same result. how can i get that unexpected failure to know up and running mounted locations.

PS:- What i want is to get actually mounted location repeatedly. (it can be kind of script which runs given interval)

Thanks

Last edited by hk_centos; 06-10-2011 at 06:17 AM. Reason: My Mistack
 
Old 06-12-2011, 01:09 AM   #13
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Original Poster
Rep: Reputation: Disabled
mount -a -t nfs

mount all nfs type remote location accordingly /etc/fstab

eachn nfs server will run this command at each reboot time

exportfs -r ( try to add this into init.d )
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove lines in a text file based on another text file asiandude Programming 10 01-29-2009 11:59 AM
Linux Text File convert to Windows/Notepad Text File = Wrapped? backroger Linux - Software 4 01-18-2009 06:54 AM
text match pipe to file then delete from original text file create new dir automatic tr1px Linux - Newbie 6 09-10-2008 10:40 PM
How to parse text file to a set text column width and output to new text file? jsstevenson Programming 12 04-23-2008 03:36 PM


All times are GMT -5. The time now is 01:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration