Restarting rc.conf

Rob spamrefuse at yahoo.com
Wed Nov 24 21:54:40 PST 2004


Paul Schmehl wrote:
> --On Monday, November 22, 2004 12:34:58 PM +0000 David Jenkins 
> <david.jenkins at gmail.com> wrote:
> 
>>
>> I would imagine for convenience - if their reasons are similar to what
>> mine were.
>>
>> i.e if you have made several changes to rc.conf then manually
>> restarting several services via /etc/rc.d or /usr/local/etc/rc.d or
>> running ifconfig is monotonous.
>>
> How monotonous is:
> 
> cd /usr/local/etc/rc.d./
> foreach file in .
> do
> $file restart
> done

This does not work if a service has been changed from YES to NO (or has
been removed from rc.conf). Therefore I think this is better:

  foreach dir in /etc/rc.d /usr/local/etc/rc.d
  do
    cd $dir
    foreach file in *
    do
      $file forcestop
      $file start
    done
  done

The "forcestop" will stop the service, no matter what's in the rc.conf file.
The "start" will only start the service, if the service is allowed in rc.conf.

Moreover, I believe this works for 5.X only.

Of course, you'd better sit at the console when you do this!

Rob.




More information about the freebsd-questions mailing list