Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jul 2002 10:54:14 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        nate <freebsd@aphroland.org>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: how to restart system services in freebsd
Message-ID:  <20020713095414.GA20663@happy-idiot-talk.infracaninophi>
In-Reply-To: <4339.10.121.110.34.1026515689.squirrel@webmail.linuxpowered.net>
References:  <4339.10.121.110.34.1026515689.squirrel@webmail.linuxpowered.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 12, 2002 at 04:14:49PM -0700, nate wrote:

> this has been a question of mine for a long time, what is the
> best way to restart services that are loaded via the rc
> file? I am used to the system V init scripts which of course
> provide an easy way to restart a service. i know that many
> ports come with contained init scripts which go to
> /usr/local/etc/rc.d ..but still a good deal seems to be
> loaded from those /etc/rc* scripts(rpc/nfs, networking etc)
 
> I know I can do it manually but am hoping for a more foolproof
> way. i looked through manpages of rc.conf and rc and could not
> find info on how to reload a specific service.
 
> while I don't mean anything negative towards freebsd's init system,
> whats the advantage of using it over the more common system V ? or
> is it there just because it's always been that way ?


You've touched here on one of those deeply rooted tribalisms: for a
long time the principal and most obvious distinction between the rival
SysV and the BSD strains of Unix was the design of the system
initialisation scripts[*].

Anyhow, the whole BSD vs SysV distinction is fading away.  Pretty much
all unix variants now implement SysV style shared memory and BSD style
long path names.  Perfectly respectable BSD-ish systems like NetBSD
and MacOS X have adopted something like SysV style initialisation
scripts.  Actually, there are distinct differences: the fundamental
concept of having a script to start and stop each different service is
there, but BSD systems don't use the /etc/inittab concept of multiple
run-levels (other than single- vs multi- user mode) and the method of
dependency ordering is different.

FreeBSD is due to follow -- the new netbsd rc scripts are being ported
and integrated into -CURRENT.

Until then, you're going to have to learn the ideosyncrasies of the
different programs you need to manipulate.  That's mostly a matter of
RTFM'ing.  Most daemons can be persuaded to reload their
configurations by a SIGHUP or shutdown cleanly by a SIGTERM (the
default generated by kill(1)).  Finding the exact command line to
start things up again is a matter of either recording what 'ps' shows,
or tracing through what the rc scripts do.  Some daemons have special
control programs (apachectl for apache httpd, rndc for bind9, amq for
the automounter amd) which you just have to know about, I'm afraid.

> same goes for networking, if I changed /etc/rc.conf to add
> virtual interfaces whats the best way to reload the configuration?
> I saw on one website:
> http://lantech.geekvenue.net/chucktips/jason/chuck/1021162365/index_html
> 
> where the author reccomended a reboot after changing rc.conf !! ack.

It is almost never *necessary* to reboot --- not unless the changes
you're making involve kernel modifications or kld's or changes to
sysctl's that can only be modified at boot time.

However, much of the time it can be easier, quicker and less error
prone to just bounce the machine.  Quite when that trade-off occurs
depends depends entirely on your knowledge and experience, so you can
understand that instructions for an inexperienced audience may err on
the side of convenience.

In answer to your specific question: use ifconfig(8) to add alias
interfaces:

    ifconfig fxp0 inet xxx.yyy.zzz.qqq netmask 255.255.255.255 alias

but read the man page and see the discussions elsewhere on this list
for the intricacies of what netmask setting you should use.

	Cheers,

	Matthew


[*] For this reason, Linux is often described as a SysV derived
system, but I'm not so sure.  Most of the Linux userland tends towards
BSD-style. (eg `ps -aux' rather than `ps -aef', `lpr' rather than
`lp'). I remember at one time reading a web page on a GNU site stating
that they were unashamedly on the BSD-ist side of the BSD-SysV divide,
but that was about ten years ago, and I can no-longer find the page in
question.  My understanding is that the Linux kernel started as an
entirely independent work, and although influenced by ideas from
elsewhere, didn't incorporate code from those systems.  Perhaps Linux
is the 3rd major clade in the unix taxonomy.

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
Tel: +44 1628 476614                                  Marlow
Fax: +44 0870 0522645                                 Bucks., SL7 1TH UK

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020713095414.GA20663>