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 server01.example.com
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.
Are you aware of the /net/server01.example.com/ feature in automounter?
It is activated by /net -hosts in /etc/auto.master and starting the autofs service.
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 what speaks against a symbolic link /nas -> /net/server01.example.com ? Then you don't need the bash script.
Try with /nas2 first so you can compare with your existing /nas
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).