Linux.com

Home Linux Community Forums Linux System Administration Command Line/Scripting want to run /etc/rc.d/rc.local in system boot time

want to run /etc/rc.d/rc.local in system boot time

Link to this post 31 Aug 10

Hi all

I would like to mount NFS file system in the kernel boot up time. ( soon after finishing booting). I have added the mount command in the file /etc/rc.d/rc.local as follows

mount -t nfs -o nolock 192.168.174.134:/nfs/test_nfs/ /mnt and its mounting success fully when i run rc.local file manually inthe command prompt as follows


/etc/rc.d/rc.local &

But I need to run rc.local automatically in the system start up time so that I can run all applications automatically.

Where to add this rc.local file , to make it's start automatic.

Please help me out to solve it.

Thanks in advance
SJR

Link to this post 31 Aug 10

rc.local isn't in rc.d, it's in the root of /etc

Edit /etc/rc.local and you're good to go :)

Be wary mounting NFS at boot like that though, it may make your system hang if there is no network connection before hand.

Link to this post 27 Mar 11

just edit /etc/rc.local bro ... hohoho like this

Link to this post 02 Apr 11

I doubt this is the best approach to get this working.

There are tools for this jobs!

You can try adding an entrance to /etc/fstab <--- if the nfs share is permanent this is the right way

or (the one I usually use)

Use autofs: default install usually automount all exported shares in the /net folder following this scheme /net/$host/$shared_folder

Therefore you could just make a symling with


ln -s /net/$host/test_nfs /mnt/test_name

This way, every time you use the folder /mnt/test_name autofs will automount the nfs share for you and you are good to go :)

This approach avoids the lockup in case there's a network failure

You must remember to add the ip address to your /etc/hosts file like:


192.168.174.134 name_you_want

Regards

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board