Date: Wed, 13 Jun 2001 12:15:25 +0300 From: Peter Pentchev <roam@orbitel.bg> To: Danny Braniss <danny@cs.huji.ac.il> Cc: Warner Losh <imp@harmony.village.org>, Sheldon Hearn <sheldonh@starjuice.net>, freebsd-hackers@FreeBSD.ORG Subject: Re: Plan to import NetBSD rc system Message-ID: <20010613121525.D22123@ringworld.oblivion.bg> In-Reply-To: <E15A5sh-000517-00@sexta.cs.huji.ac.il>; from danny@cs.huji.ac.il on Wed, Jun 13, 2001 at 11:20:03AM %2B0300 References: <imp@harmony.village.org> <E15A5sh-000517-00@sexta.cs.huji.ac.il>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010613121525.D22123>