From owner-freebsd-rc@FreeBSD.ORG Sun Aug 8 16:26:49 2004 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA15116A4CE for ; Sun, 8 Aug 2004 16:26:49 +0000 (GMT) Received: from web50302.mail.yahoo.com (web50302.mail.yahoo.com [206.190.38.56]) by mx1.FreeBSD.org (Postfix) with SMTP id 87DE843D1F for ; Sun, 8 Aug 2004 16:26:49 +0000 (GMT) (envelope-from cykyc@yahoo.com) Message-ID: <20040808162649.80859.qmail@web50302.mail.yahoo.com> Received: from [209.98.54.121] by web50302.mail.yahoo.com via HTTP; Sun, 08 Aug 2004 09:26:48 PDT Date: Sun, 8 Aug 2004 09:26:48 -0700 (PDT) From: Jon Passki To: freebsd-rc@freebsd.org In-Reply-To: <20040807214302.73783.qmail@web50307.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: Feature request to rc.d: managing subsets of scripts X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: cykyc@yahoo.com List-Id: Discussion related to /etc/rc.d design and implementation. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2004 16:26:50 -0000 Gratuitous self-reply :-/ --- Jon Passki wrote: > Hello All, > > I wish accomplish the following with rc.d scripts: > > 1) Scripts can be assigned to a subset; > 2) Subsets can be ordered, with this order honored by rcorder; > 3) Subsets can be independently started and stopped after the > initial system startup; > > For me, the usage would be in situations where I have a bunch of > interdependent scripts that would need a stop/start when for > example I'm remounting a file system or reassigning daemons to a > different network interface. This way, I could assign scripts to > subsets if I know that they utilize common interfaces or mounts. > It is implied that if a script wasn't placed in a subset it > should > continue to function even though it may depend on or be a > dependent > of a subset that was stopped. It is the responsibility of the > sysadmin to properly segment subsets. > > 1) & 2) can be accomplished with the REQUIRE, PROVIDE and BEFORE > lines. This would also make me alter each rc.d script I wish to > manage, but that is acceptable. It's unknown to me if subsets > should be disjointed. > > It isn't obvious to me, though, if 3) could work that way. I > still > would see rcorder doing it's magic, but it would need a filter to > only order that subset. The KEYWORD line could be used in > addition > to the other lines, but adds some redundancy. According to [1], > rcorder logically OR's keep list switches. It would have to AND > them in this case to handle a) the FreeBSD switch and b) more > importantly, manage more than one subset. snippit for 3) subsets="zone1 internal external" for _i in ${subsets} do if [ -z "${_regexp}" ]; then _regexp="'^# KEYWORDS?:.*${_i}" else _regexp="${_regexp}|^# KEYWORDS?:.*${_i}" fi done _files=`eval "grep -El ${_regexp}' ${some_path}"` rcorder ${skip} ${_files} 2>/dev/null Thanks to Oliver Eikemeier for the KEYWORD string :-) Jon Passki p.s. This satisfies things for me. YMMV __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail From owner-freebsd-rc@FreeBSD.ORG Sun Aug 8 17:01:52 2004 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 232CD16A4CE for ; Sun, 8 Aug 2004 17:01:52 +0000 (GMT) Received: from web50307.mail.yahoo.com (web50307.mail.yahoo.com [206.190.38.61]) by mx1.FreeBSD.org (Postfix) with SMTP id A3F7743D41 for ; Sun, 8 Aug 2004 17:01:51 +0000 (GMT) (envelope-from cykyc@yahoo.com) Message-ID: <20040808170151.64512.qmail@web50307.mail.yahoo.com> Received: from [209.98.54.121] by web50307.mail.yahoo.com via HTTP; Sun, 08 Aug 2004 10:01:51 PDT Date: Sun, 8 Aug 2004 10:01:51 -0700 (PDT) From: Jon Passki To: freebsd-rc@freebsd.org In-Reply-To: <20040808162649.80859.qmail@web50302.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: Feature request to rc.d: managing subsets of scripts X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: cykyc@yahoo.com List-Id: Discussion related to /etc/rc.d design and implementation. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2004 17:01:52 -0000 Sorry, another self-reply... > subsets="zone1 internal external" > > for _i in ${subsets} > do > if [ -z "${_regexp}" ]; then > _regexp="'^# KEYWORDS?:.*${_i}" > else > _regexp="${_regexp}|^# KEYWORDS?:.*${_i}" > fi > done > _files=`eval "grep -El ${_regexp}' ${some_path}"` > rcorder ${skip} ${_files} 2>/dev/null Wow, I just re-implemented rcorder -k subset1 -k subset2 -k subset3 ... I'm gonna stop posting for a bit and think before I send. Sorry 'bout the traffic. Jon __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail From owner-freebsd-rc@FreeBSD.ORG Wed Aug 11 00:08:01 2004 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7B64F16A4CE for ; Wed, 11 Aug 2004 00:08:01 +0000 (GMT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A82C43D3F for ; Wed, 11 Aug 2004 00:08:01 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.10/8.12.10) with ESMTP id i7B080OF016359; Tue, 10 Aug 2004 17:08:01 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.10/8.12.3/Submit) id i7B080e8016358; Tue, 10 Aug 2004 17:08:00 -0700 Date: Tue, 10 Aug 2004 17:08:00 -0700 From: Brooks Davis To: Jon Passki Message-ID: <20040811000800.GA5987@Odin.AC.HMC.Edu> References: <20040807214302.73783.qmail@web50307.mail.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ReaqsoxgOBHFXBhH" Content-Disposition: inline In-Reply-To: <20040807214302.73783.qmail@web50307.mail.yahoo.com> User-Agent: Mutt/1.5.4i cc: freebsd-rc@freebsd.org Subject: Re: Feature request to rc.d: managing subsets of scripts X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to /etc/rc.d design and implementation. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2004 00:08:01 -0000 --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 07, 2004 at 02:43:02PM -0700, Jon Passki wrote: > Hello All, >=20 > I wish accomplish the following with rc.d scripts: >=20 > 1) Scripts can be assigned to a subset; > 2) Subsets can be ordered, with this order honored by rcorder; > 3) Subsets can be independently started and stopped after the > initial system startup; >=20 > For me, the usage would be in situations where I have a bunch of > interdependent scripts that would need a stop/start when for > example I'm remounting a file system or reassigning daemons to a > different network interface. This way, I could assign scripts to > subsets if I know that they utilize common interfaces or mounts.=20 > It is implied that if a script wasn't placed in a subset it should > continue to function even though it may depend on or be a dependent > of a subset that was stopped. It is the responsibility of the > sysadmin to properly segment subsets. >=20 > 1) & 2) can be accomplished with the REQUIRE, PROVIDE and BEFORE > lines. This would also make me alter each rc.d script I wish to > manage, but that is acceptable. It's unknown to me if subsets > should be disjointed. >=20 > It isn't obvious to me, though, if 3) could work that way. I still > would see rcorder doing it's magic, but it would need a filter to > only order that subset. The KEYWORD line could be used in addition > to the other lines, but adds some redundancy. According to [1], > rcorder logically OR's keep list switches. It would have to AND > them in this case to handle a) the FreeBSD switch and b) more > importantly, manage more than one subset. I want this feature. What I want it for is to have a set of scripts that run before the standard ones so initdiskless can add scripts to /etc/rc.d (and thus I can keep /etc/rc.d stock). What I'm planning to do is to add a -K option to rcorder which will make keywords evaluate ANDed. Keywords will still be passed with -k, just the evaluation function will change. Here's a patch for rcorder that adds this function. A patch to /etc/rc is also needed to handle the subsets. I'm not 100% sure how to do this given my desire to have an "early" set that runs before everything. Maybe we should just hardcode that one. -- Brooks =3D=3D=3D=3D //depot/user/brooks/cleanup/sbin/rcorder/rcorder.8#2 - /home/b= rooks/working/freebsd/p4/cleanup/sbin/rcorder/rcorder.8 =3D=3D=3D=3D @@ -39,6 +39,7 @@ .Nd print a dependency ordering of interdependent files .Sh SYNOPSIS .Nm +.Op Fl K .Op Fl k Ar keep .Op Fl s Ar skip .Ar @@ -92,12 +93,23 @@ .Pp The options are as follows: .Bl -tag -width indent +.It Fl K +Require all keywords in the +.Dq "keep list" +to be in each file. +The default is to require one or more. .It Fl k Add the specified keyword to the .Dq "keep list" . If any .Fl k -option is given, only those files containing the matching keyword are list= ed. +option is given, only those files containing one or more of the matching +keyword are listed. +The +.Fl K +option causes all keywords in the +.Dq "keep list" +to be required. .It Fl s Add the specified keyword to the .Dq "skip list" . =3D=3D=3D=3D //depot/user/brooks/cleanup/sbin/rcorder/rcorder.c#1 - /home/b= rooks/working/freebsd/p4/cleanup/sbin/rcorder/rcorder.c =3D=3D=3D=3D @@ -69,6 +69,7 @@ #define KEYWORDS_STR "# KEYWORDS:" #define KEYWORDS_LEN (sizeof(KEYWORDS_STR) - 1) =20 +int keyword_or =3D 1; int exit_code; int file_count; char **file_list; @@ -155,7 +156,7 @@ { int ch; =20 - while ((ch =3D getopt(argc, argv, "dk:s:")) !=3D -1) + while ((ch =3D getopt(argc, argv, "dKk:s:")) !=3D -1) switch (ch) { case 'd': #ifdef DEBUG @@ -164,6 +165,9 @@ warnx("debugging not compiled in, -d ignored"); #endif break; + case 'K': + keyword_or =3D 0; + break; case 'k': strnode_add(&keep_list, optarg, 0); break; @@ -704,13 +708,25 @@ strnodelist *s; strnodelist *k; =20 - for (s =3D keep_list; s; s =3D s->next) - for (k =3D fnode->keyword_list; k; k =3D k->next) - if (strcmp(k->s, s->s) =3D=3D 0) - return (1); + for (s =3D keep_list; s; s =3D s->next) { + for (k =3D fnode->keyword_list; k; k =3D k->next) { + if (strcmp(k->s, s->s) =3D=3D 0) { + if (keyword_or) + return (1); + else + break; + } + } + if (!keyword_or && k =3D=3D NULL) + return (0); + } =20 - /* an empty keep_list means every one */ - return (!keep_list); + if (keyword_or) { + /* an empty keep_list means every one */ + return (!keep_list); + } else { + return (1); + } } =20 /* --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --ReaqsoxgOBHFXBhH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFBGWNfXY6L6fI4GtQRAtTfAJwNtTm5IwrxHn7vpl+TBaQLMoeEEgCgsE2b M6cxpa85PDBUOHqTWwYlehg= =i71T -----END PGP SIGNATURE----- --ReaqsoxgOBHFXBhH-- From owner-freebsd-rc@FreeBSD.ORG Thu Aug 12 16:49:30 2004 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E208716A4CE; Thu, 12 Aug 2004 16:49:30 +0000 (GMT) Received: from horsey.gshapiro.net (horsey.gshapiro.net [64.105.95.154]) by mx1.FreeBSD.org (Postfix) with ESMTP id ABE2843D1D; Thu, 12 Aug 2004 16:49:30 +0000 (GMT) (envelope-from gshapiro@gshapiro.net) Received: from horsey.gshapiro.net (localhost [127.0.0.1]) i7CGnUwK043154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 Aug 2004 09:49:30 -0700 (PDT) Received: (from gshapiro@localhost)i7CGnUij043153; Thu, 12 Aug 2004 09:49:30 -0700 (PDT) Date: Thu, 12 Aug 2004 09:49:30 -0700 From: Gregory Neil Shapiro To: Andrey Chernov Message-ID: <20040812164930.GZ11227@horsey.gshapiro.net> References: <20040808055343.GA572@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040808055343.GA572@nagual.pp.ru> User-Agent: Mutt/1.5.6i cc: ports@freebsd.org cc: freebsd-rc@freebsd.org Subject: Re: sendmail starts too early? X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to /etc/rc.d design and implementation. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2004 16:49:31 -0000 On Sun, Aug 08, 2004 at 09:53:44AM +0400, Andrey Chernov wrote: > There is a problem using sendmail with milters, which usually lives in > /usr/local/* and starts from /usr/local/etc/rc.d/* > > Currently, sendmail starts before them, which produce this example > diagnostic: > > Starting sendmail. > WARNING: Xsentinel: local socket name /var/spool/sentinel/sentinel.socket missing > WARNING: Xantivir-milter: local socket name /var/spool/avmilter/avmilter.sock missing > > When they starts afterwards, situation normalizes, but there is a gap > between, where whole system can reject or do something potentially wrong > with messages. > > Since converting each milter startup script under rc.subr technology is > painful task, what about starting sendmail _after_ /etc/rc.d/localpkg > starts? I see no drawback in that case. I personally don't see a problem in that unless some of the /usr/local/etc/rc.d/ scripts require an MTA to be running by the time they start. If things are going to change in this area, I would also suggest moving virecover to after sendmail starts (currently it is before) as that script's purpose is to mail users telling them that recovery files exist. Likewise, the resolv and nsswitch scripts should run before sendmail starts (currently they are run after) since they will both impact sendmail's operation. This should however be passed by the rc.d folks as well (freebsd-rc Cc'ed).