From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-dev-return-2924-arch-gentoo-dev=gentoo.org@gentoo.org>
Received: (qmail 15922 invoked by uid 1002); 6 May 2003 19:59:40 -0000
Mailing-List: contact gentoo-dev-help@gentoo.org; run by ezmlm
Precedence: bulk
List-Post: <mailto:gentoo-dev@gentoo.org>
List-Help: <mailto:gentoo-dev-help@gentoo.org>
List-Unsubscribe: <mailto:gentoo-dev-unsubscribe@gentoo.org>
List-Subscribe: <mailto:gentoo-dev-subscribe@gentoo.org>
List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org>
X-BeenThere: gentoo-dev@gentoo.org
Received: (qmail 16122 invoked from network); 6 May 2003 19:59:39 -0000
X-Authentication-Warning: bru-cse-075.cisco.com: wmertens owned process doing -bs
Date: Tue, 6 May 2003 21:59:37 +0200 (CEST)
From: Wout Mertens <wmertens@gentoo.org>
X-X-Sender: wmertens@bru-cse-075.cisco.com
To: Martin Schlemmer <azarah@gentoo.org>
cc: Wolfram Schlich <lists@schlich.org>,
   Gentoo-Dev mailinglist <gentoo-dev@gentoo.org>
In-Reply-To: <1052246617.7144.9.camel@nosferatu.lan>
Message-ID: <Pine.GSO.4.53.0305062156570.6252@bru-cse-075.cisco.com>
References: <20030505202336.ALLYOURBASEAREBELONGTOUS.I23529@bla.fasel.org> 
 <1052167146.4459.41.camel@nosferatu.lan>  <Pine.GSO.4.53.0305061129380.6252@bru-cse-075.cisco.com>
 <1052246617.7144.9.camel@nosferatu.lan>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Subject: Re: [gentoo-dev] rc-scripts/init: new service dependency
X-Archives-Salt: 303a5d30-b4e0-4be0-9cdc-799a97ee8c8e
X-Archives-Hash: 5fc0e2a3c193a5daf8e76c1dfa7598a1


On Tue, 6 May 2003, Martin Schlemmer wrote:

> On Tue, 2003-05-06 at 11:40, Wout Mertens wrote:
>
> > How about subscribe? And you can ask to be called before and/or after the
> > script you subscribe to:
> >
> > subscribe after net.ppp0
> >
> > event() {
> > 	case $2 in
> > 		start|restart)
> > 			start
> > 			;;
> > 		stop)
> > 			stop
> > 			;;
> > 	esac
> > }
> >
> > This would make runscript call ddclients event() after net.ppp0 was run,
> > with $1 set to the script, $2 set to the action and $3 set to before or
> > after.
> >
>
> Well, if you need to start something before, you can just use 'use', or
> 'before/after'.
>
> I think what he wants, and what will be a unique addition, is being able
> to tell a script:  If you start successfully, start 'foobar'

That's what I meant: when the service is called for an action (start,
stop, restart, reload, custom things), runscript will run the event()
function for all the scripts that are subscribed to that script, and then
those scripts can figure out what to do with it themselves...

And the gentoo-net scripts that I am working on will go down a
user-configurable list when certain things happen. (interface up/down, ip
address changed, etc.

The design pattern we're looking at here is events and interested parties,
and it's just a matter of defining what events we handle and how we notify
the parties.

Wout.

--
gentoo-dev@gentoo.org mailing list