Welcome to the Linux Foundation Forum!

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

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

Comments

  • Jinux
    Jinux Posts: 20
    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.
  • marc
    marc Posts: 647
    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

Categories

Upcoming Training