Re: reload rc.conf during boot process

From: Markie (mark.cullen_at_dsl.pipex.com)
Date: 09/21/04

  • Next message: David Kelly: "Re: vinum software raid as boot drive"
    To: "Giorgos Keramidas" <keramida@ceid.upatras.gr>
    Date: Tue, 21 Sep 2004 14:18:04 +0100
    
    

    ----- Original Message -----
    From: "Giorgos Keramidas" <keramida@ceid.upatras.gr>
    To: "Markie" <mark.cullen@dsl.pipex.com>
    Cc: <freebsd-questions@freebsd.org>
    Sent: Tuesday, September 21, 2004 10:36 AM
    Subject: Re: reload rc.conf during boot process

    | On 2004-09-21 00:26, Markie <mark.cullen@dsl.pipex.com> wrote:
    | > Is it possible to do this somehow?
    | >
    | > I was trying my hand out at C and made a cool little menu for myself.
    It
    | > looks for files in /etc/ which are named rc.conf.xxxxx and lists them
    in
    | > the menu. Then, when you select one on boot, it copies the selected
    | > configuration file to rc.conf. I put my program in... the rc.d mount
    | > script, so that the disk is mounted writeable at the time and my C
    program
    | > is able to issue cp (bad way I know) to replace rc.conf. After running
    my
    | > program in the rc.d mount script I then did a
    | >
    | > . /etc/rc.conf
    | >
    | > but rc.conf doesn't get reloaded. The file is being copied over, as
    when I
    | > reboot it starts using the copied over configuration. I am not sure if
    .
    | > /etc/rc.conf is supposed to load a file in? I just saw it in some other
    | > script and assumed that's what it was doing.
    |
    | The /etc/rc script is a ``driver script'' that loads rc.conf before teh
    | mount script has a chance to run. Even if you reload rc.conf in the
    | mountd script this cannot affect the parent process that runs /etc/rc.
    |

    Oh I think I see what you're saying, it's kind of like variable scope,
    right? When I do . /etc/rc.conf in mountcritlocal that's loading the file,
    but only for that script? It's not actually replacing the variables at all,
    right?

    | I believe a good way to do this would be to add a special script in
    | /etc/rc.d that depends on mountcritlocal that can give you the rc.conf
    | selection menu and then hack /etc/rc to reload rc.conf if this special
    | script runs and does indeed change `/etc/rc.conf'.

    Wonder why I didn't make a seperate script for the menu in the first place!
    Great idea, thanks!

    |
    | For instance, if you called your special rc.d script that presents the
    | rc.conf selection menu ``selectcf'' and saved it in /etc/rc.d, then you
    | could use something like this in /etc/rc to make sure it rereads rc.conf
    | if changes are made to rc.conf:
    |

    I saw load_rc_config 'XXX' in early.sh or something, just a minute ago!
    Does the XXX do anything?

    load_rc_config() {
        _command=$1

        [....]

        if [ -f /etc/rc.conf.d/"$_command" ]; then
            . /etc/rc.conf.d/"$_command"
        fi

        [....]
    }

    I don't actually have rc.conf.d either, as far as I can tell?

    Thanks for the rc changes too! I'll give that a read and try and understand
    it then give it a shot :-)
    Much appreciated!

    My idea was so I could try out FreeBSD on my laptop and keep it usable on
    the University network, but I use NIS and NFS at home so I need some sort
    of caching going on or something. No idea how to do that! Maybe something
    has already been done? Searching for 'NIS password cache' only came up with
    some DNS cache thing.

    | % Index: rc
    | % ===================================================================
    | % RCS file: /home/ncvs/src/etc/rc,v
    | % retrieving revision 1.333
    | % diff -u -r1.333 rc
    | % --- rc 24 Jul 2004 16:30:31 -0000 1.333
    | % +++ rc 21 Sep 2004 09:34:08 -0000
    | % @@ -71,7 +71,20 @@
    | % files=`rcorder -k ${os} ${skip} /etc/rc.d/* 2>/dev/null`
    | %
    | % for _rc_elem in ${files}; do
    | % - run_rc_script ${_rc_elem} ${_boot}
    | % + case ${_rc_elem} in
    | % + /etc/rc.d/selectcf)
    | % + _sum_before=`md5 /etc/rc.conf`
    | % + run_rc_script ${_rc_elem} ${_boot}
    | % + _sum_after=`md5 /etc/rc.conf`
    | % + if [ ! "${_sum_before}" = "${_sum_after}" ]; then
    | % + unset _rc_conf_loaded
    | % + load_rc_config 'XXX'
    | % + fi
    | % + ;;
    | % + *)
    | % + run_rc_script ${_rc_elem} ${_boot}
    | % + ;;
    | % + esac
    | % done
    | %
    | % echo ''
    |

    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: David Kelly: "Re: vinum software raid as boot drive"

    Relevant Pages

    • PHP Program Randomly Stops
      ... "You can use a combination of PHP with client side code to keep the ... are pages to be processed print a client side script, e.g. JavaScript, ... This will reload until all pages are done - then ... "You are running the script from a browser. ...
      (comp.lang.php)
    • Re: Running long script in the background
      ... and forgotten (except for the presence of session cookies). ... timed-redirect (reload) of the same URL with the cookie, ... completely separate transaction starting a new CGI ... script on the server that untars a 600 meg volume, ...
      (comp.lang.python)
    • Re: Please advise on making a linux system service
      ... But most of them also takes restart, reload, ... configuration files without actually terminating. ... script source at the very begining. ... This pid may be needed to signal the ...
      (comp.os.linux.development.system)
    • Re: simple javascript function
      ... Mine does the same (with a different approach - I just don't reload the ... "Jon Spivey" wrote in message ... >>> with script, eg say you had a form like this ... Murray ...
      (microsoft.public.frontpage.programming)
    • Re: reload rc.conf during boot process
      ... reload rc.conf during boot process ... |> I was just looking at that diff you attached. ... |> nothing matches, i.e if the script isn't called selectcf, then it'll ... to actually run my selectcf script? ...
      (freebsd-questions)