Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 17 of 17
Originally Posted by sjremya Hi I have selected rc.local method. I tested the rc.local file manually by starting it in the command prompt as shown here : # /etc/rc.d/rc.local & ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Just Joined! buteman's Avatar
    Join Date
    Jul 2006
    Location
    Isle of Bute, Scotland
    Posts
    75

    Quote Originally Posted by sjremya View Post
    Hi

    I have selected rc.local method.

    I tested the rc.local file manually by starting it in the command prompt as shown here :

    # /etc/rc.d/rc.local &

    Its running fine ,and executing the script commands i given in that. But how to run it automatically in the boot time? I mean where to run this rc.local file in the filesystem to make it run automatically. Thats my problem. Please help me out

    regards
    SJR

    What have you put in rc.local? It should run at startup after it has done all its other stuff so if it works when you run it manually it should when it runs at startup.

  2. #12
    Just Joined! sjremya's Avatar
    Join Date
    May 2010
    Location
    India
    Posts
    39
    Quote Originally Posted by buteman View Post
    What have you put in rc.local? It should run at startup after it has done all its other stuff so if it works when you run it manually it should when it runs at startup.
    thanks for the reply

    I am not sure whether i can use rc.local or not[ bcoz my file system doesnot have an rc.conf file to control rc.local]

    What i did as of now , i ll describe here

    1. Created /etc/rc.local and added mount -t -o nolock <mount_distant-machine> <my-mount_point>

    2. Added /etc/rc.local & in /etc/init.d/rcS file, but it did not execute the mount command from rc.local [ other echo messages are printing correctly. so i guess , problem is only with mount command. ]

    3. after boot up [ i mean, after initializing all devices especially NETWORK ] , i ran manually /etc/rc.local & in command prompt. ITS working and MOUNTING filesystem.

    Here is my question ? How to mount this NFS after initializing network? where to add my mount command to achieve this.

  3. #13
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    so, you will need to create a script that mounts NFS shares and put it into the correct rcX.d directory

    basically all the script needs to contain is this line
    Code:
    /bin/mount -a -t nfs,nfs4
    then it should mount any nfs entries in your fstab file

    typically the scripts that go in rcX.d are executed in order by name, so you will have to make sure your script gets executed after network init by naming it in the right way

  4. $spacer_open
    $spacer_close
  5. #14
    Just Joined! buteman's Avatar
    Join Date
    Jul 2006
    Location
    Isle of Bute, Scotland
    Posts
    75
    Quote Originally Posted by sjremya View Post
    thanks for the reply

    I am not sure whether i can use rc.local or not[ bcoz my file system doesnot have an rc.conf file to control rc.local]

    What i did as of now , i ll describe here

    1. Created /etc/rc.local and added mount -t -o nolock <mount_distant-machine> <my-mount_point>

    2. Added /etc/rc.local & in /etc/init.d/rcS file, but it did not execute the mount command from rc.local [ other echo messages are printing correctly. so i guess , problem is only with mount command. ]

    3. after boot up [ i mean, after initializing all devices especially NETWORK ] , i ran manually /etc/rc.local & in command prompt. ITS working and MOUNTING filesystem.

    Here is my question ? How to mount this NFS after initializing network? where to add my mount command to achieve this.
    The system runs rc.local itself after it has run the other scripts.
    You do not add a command to run it from somewhere yourself. This may be your problem. If it still fails then it may be because networking is not fully established when it runs so you may need to put a delay as the first command in it so it waits a while

  6. #15
    Just Joined! buteman's Avatar
    Join Date
    Jul 2006
    Location
    Isle of Bute, Scotland
    Posts
    75
    This is what I have in /etc/fstab on my Ubuntu system and I do not need any other commands for it to get mounted:

    192.168.1.72:/home/nfsuser /home/nfsshare nfs rw,bg,hard,intr 0 0

    At startup it is reported that it cannot be mounted but note from man nfs:


    soft / hard Determines the recovery behavior of the NFS client after an NFS request times out. If neither option is specified (or if the hard option is specified), NFS requests are retried indefinitely. If the soft option is specified, then the NFS client fails an NFS
    request after retrans retransmissions have been sent, causing the NFS client to return an error to the calling application.

    and also:

    bg / fg Determines how the mount command behaves if an attempt to mount an export fails. The fg option causes mount to exit with an error status if any part of the mount request times out or fails outright. This is called a "foreground" mount, and is the default behavior if neither the fg nor bg mount option is specified.

    If the bg option is specified, a timeout or failure causes the mount command to fork a child which continues to attempt to mount the export. The parent immediately returns with a zero exit code. This is known as a "background" mount.

  7. #16
    Just Joined! sjremya's Avatar
    Join Date
    May 2010
    Location
    India
    Posts
    39
    Quote Originally Posted by buteman View Post
    The system runs rc.local itself after it has run the other scripts.
    You do not add a command to run it from somewhere yourself. This may be your problem. If it still fails then it may be because networking is not fully established when it runs so you may need to put a delay as the first command in it so it waits a while
    Thanks for the reply

    I would like to mention one more thing here.

    My distribution is open suse. I could not find rc.local or boot.local file( where we can add local commands) in its /etc/ directory. So I want to use only /etc/fstab modificatiion to achieve NFS mounting .

    But I feel /etc/fstab is not running before network fires up. So NFS is failing. How to make it sure that my network is working properly ?

  8. #17
    Just Joined! sjremya's Avatar
    Join Date
    May 2010
    Location
    India
    Posts
    39
    Hi all

    Happy to say that i solved NFS mounting problem in system boot up . Thank you all for your valuable suggestions.

    It was a simple network problem.

    When I tried to mount NFS in /etc/init.d/rcs, network was not initialized properly. I have changed the position of network bringup to top (ifconfig eth0 <ip_addr> netmask <net_mask> up) in /etc/rc.d/rcS and gave some delay to establish network. At last i did NFS mounting using mount command.

    mount -t nfs -o nolock <distant_machine> <my_mnt_pint> . It works fine.

    But I wasted my time to look into fstab file to implement it . It is so easy to implement in rcS file.

    Regards
    SJR

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •