From owner-freebsd-hackers Wed Jun 13 2:16:55 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 926F837B405 for ; Wed, 13 Jun 2001 02:16:46 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 27088 invoked by uid 1000); 13 Jun 2001 09:15:25 -0000 Date: Wed, 13 Jun 2001 12:15:25 +0300 From: Peter Pentchev To: Danny Braniss Cc: Warner Losh , Sheldon Hearn , freebsd-hackers@FreeBSD.ORG Subject: Re: Plan to import NetBSD rc system Message-ID: <20010613121525.D22123@ringworld.oblivion.bg> Mail-Followup-To: Danny Braniss , Warner Losh , Sheldon Hearn , freebsd-hackers@FreeBSD.ORG References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from danny@cs.huji.ac.il on Wed, Jun 13, 2001 at 11:20:03AM +0300 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Jun 13, 2001 at 11:20:03AM +0300, Danny Braniss wrote: > few points to add/concider: > > I share the /usr/local among many machines, so /usr/local/etc/rc.d is becoming > 'problematic', rc.conf should be involved in the decission to run xxx.sh > start/stop > > on other platforms, i've modified rc to run rc.`hostname` if such file exists. > this little trick saved the day many times - i would dump|restore the root > partition onto another host, and reboot. > > having to manage many hosts, it's becoming important to centralize some of > the configuration data (Nis/Hesiod based info). I configure amd that is > heavely used here, via hesiod. > > having experienced rc since V6, i have seen some nice ideas and 01some > 22horrible > 99ones, FreeBSD's so far looks the best! true, i haven't seen NetBSD, and i > will > asap. I've asked -ports before whether it is suitable to let ports startup scripts honor /etc/rc.conf{,.local} settings by sourcing /etc/defaults/rc.conf and then running a source_rc_confs (or whatever is appropriate). This could be a solution to your problem - modify the ports' startup scripts to honor rc.conf options, then put appropriate enable/disable options in each machine's /etc/rc.conf or /etc/rc.conf.local. Attached is an example - a modification of the databases/mysql323-server port's startup script to honor a couple of mysqld_* variables from the RC script scheme. This approach has the disadvantage that the ports' startup scripts will have to be modified if the base system startup mechanism changes, or at least when the base system /etc/{defaults}/rc.conf{.local} parsing mechanism changes. G'luck, Peter -- Do you think anybody has ever had *precisely this thought* before? Index: ports/databases/mysql323-server/files/mysql-server.sh =================================================================== RCS file: /home/ncvs/ports/databases/mysql323-server/files/mysql-server.sh,v retrieving revision 1.2 diff -u -r1.2 mysql-server.sh --- ports/databases/mysql323-server/files/mysql-server.sh 2000/07/05 12:36:21 1.2 +++ ports/databases/mysql323-server/files/mysql-server.sh 2001/03/19 09:25:38 @@ -1,13 +1,39 @@ #!/bin/sh +. /etc/defaults/rc.conf +if type source_rc_confs | fgrep 'shell function' > /dev/null; then + source_rc_confs +else + rc_conf_files=${rc_conf_files-"/etc/rc.conf /etc/rc.conf.local"} + for i in ${rc_conf_files}; do + if [ -r "$i" ]; then + . $i + fi + done +fi + +# The following variables may be overridden in /etc/rc.conf or +# /etc/rc.conf.local + +# The base directory (prefix) for the MySQL installation +mysqld_prefix=${mysqld_prefix-"%%PREFIX%%"} +# The MySQL server executable +mysqld_program=${mysqld_program-"${mysqld_prefix}/bin/safe_mysqld"} +# The MySQL server process, passed to 'killall' to stop the server +mysqld_process=${mysqld_process-"mysqld"} +# The user that the MySQL server runs as +mysqld_user=${mysqld_user-"mysql"} +# Any additional flags for the MySQL server +mysqld_flags=${mysqld_flags-""} + case "$1" in start) - if [ -x %%PREFIX%%/bin/safe_mysqld ]; then - %%PREFIX%%/bin/safe_mysqld --user=mysql > /dev/null & && echo -n ' mysqld' + if [ -x "${mysqld_program}" ]; then + ${mysqld_program} --user=${mysqld_user} ${mysqld_flags} > /dev/null & && echo -n ' mysqld' fi ;; stop) - /usr/bin/killall mysqld > /dev/null 2>&1 && echo -n ' mysqld' + /usr/bin/killall "${mysqld_process}" > /dev/null 2>&1 && echo -n ' mysqld' ;; *) echo "" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message