Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.

Mount NFS Share On NFS Client via bash script.

Login or Register to Reply

Thread Tools Search this Thread
# 1  
Mount NFS Share On NFS Client via bash script.

I need a help of good people with effective bash script to mount nfs shared,
By the way I did the searches, since i haven't found that someone wrote a script like this in the past, I'm sure it will serve more people.

The scenario as follow:
An NFS Client with Daily CRON , running bash script that:
Reading the output of:
showmount -e

And if certain mount does not exist In /etc/fstab.
It will insert the mount to /etc/fstab with following nfs attribute and options,
With creation of relevant "/nfs/x" shares, under the "/nas" directory on client.
Code: /nas/test nfs tcp,hard,intr,noatime 0 0 /nas/data nfs tcp,hard,intr,noatime 0 0 /nas/logs nfs tcp,hard,intr,noatime 0 0

Thanks all.

Last edited by vbe; 03-13-2016 at 08:27 AM.. Reason: code tags please even for so lttle...
# 2  
Are you aware of the /net/ feature in automounter?
It is activated by /net -hosts in /etc/auto.master and starting the autofs service.
# 3  
Hi, Made.
I'm familiar with "/net" of the autofs terminology,
but in my case i will need to apply it via bash script.
I came across a several scripts that mount nfs shares on client ,But what is common to all, is that you required to specify the shared/exports.

And in my case the path = x

i.e :
Situation where someone added a new line to NFS Server /etc/exports,
And Client will handle on the mount through bash script that:
1. Read showmount -e
2.Verify that /nfs/x already exist in /nas under fstab
if not:
3. Create folder
4. Add it to fstab with under "/nas/x" with "nfs tcp,hard,intr,noatime 0 0"
5. mount share.
# 4  
And what speaks against a symbolic link /nas -> /net/ Then you don't need the bash script.
Try with /nas2 first so you can compare with your existing /nas
# 5  
May I question the point of having a daily job to update /etc/fstab? Even if shares were added frequently (daily), you wouldn't see them but the next day. And, what about removed shares?

If the clients are continuously up and running, create a script that actively distributes the new (or removed!) share info from the server to all the clients. If they aren't, a daily cron doesn't help anyway (but mayhap a boot script to fetch that info and update the local tables).
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Solaris 10 NFS client cannot mount a share from a Windows server
I have a Solaris 10 server, I'm trying to mount a share from a Windows nfs server. If I add this entry (tst-walnut:/test_sap_nfs - /majid nfs - yes rw,soft) to my /etc/vfstab, then I can mount, but when I create a file by root:root, the file owner changes to...... Solaris
Not able to mount NFS share on client side
When i tried to mount the nfs i see this error message mount -t nfs /nfsmount mount: failed, reason given by server: Permission denied and the /etc/exports file in the host side looks like this /remote/proj1 ...... Red Hat
Red Hat
Can't see home folder on one NFS mount but can in another mount on another share
Hello, I have a few Ubuntu 9.10 laptops I'm trying to learn NFS sharing with. I am just experimenting on this right now, so no harsh words about the security of what I'm playing with, please ;) Below are the configs /etc/exports on host /home/woodnt/Homeschool...... IP Networking
IP Networking
how to mount Windows NFS share on solaris
Hi, How can i mount an NFS share on a solaris machine a filesystem ? I have enabled nfs on a windows server and the shares has given read/write access to it to all the users. I would like to mount it on around 10 different solaris boxes with different versions of solaris. Thanks in advance.... Solaris
NFS client Mount script after boot
Hi, I have 12 AIX P series servers. One has the NFS DB2data and the others are client mounts. NFS is not in /etc/filesystem because if NFS DB2data not up the client takes 7+ minutes to give up on nfsmnt and boot up. I'd like to check that nfs is up, then do the client mount all from a startup...... Shell Programming and Scripting
Shell Programming and Scripting

Featured Tech Videos