Date: Fri, 22 Sep 1995 20:47:13 -0500 (CDT) From: peter@taronga.com (Peter da Silva) To: gryphon@healer.com (Coranth Gryphon) Cc: hackers@freebsd.org, peter@taronga.com Subject: Re: ports startup scripts Message-ID: <199509230147.UAA03904@bonkers.taronga.com> In-Reply-To: <199509221450.KAA03655@healer.com> from "Coranth Gryphon" at Sep 22, 95 10:50:53 am
next in thread | previous in thread | raw e-mail | index | archive | help
> Why bother with "rc*" directories then? Because that's where the scripts get run from. > Just have an "inittab" (or "init.conf" > or whatever) file which says what to start up and shut down when and > then you can put them all in one directory. Then you hhave to edit that file whenever you add a new service. > It looks like the "S" and "K" scripts are for starting and stopping > things. There are two ways of doing this. > First, you can have the "K" run when leaving a level (to go to a lower level > not a higher one), and the "S" when entering a level (unless coming from > a higher one). Never mind, that's overly complex. > The other way is you run everything in a single directory (S and K) > when going to that directory. This actually makes the most sense to me. Actually, what you do is: On going from a lower level to a higher level, you run the S.* scripts in order, with the argument "start". On going from a higher level to a lower, you run the K.* scripts in order, with the argument "stop". In each case you run the scripts on entering a level. Each script looks like this: case "$1" in start) bring service up;; stop) bring service down;; restart) stop and start service or otherwise tell it to reconfigure itself;; esac For example: case "$1" in start) /usr/sbin/inetd;; stop) kill `cat /var/run/inetd.pid`;; restart) kill -HUP `cat /var/run/inetd.pid`;; esac This way you have a single file that contains instructions for bringing up and taking down the service. No more looking around to find out how to do it cleanly.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509230147.UAA03904>