1 |
On Tue, 6 May 2003, Martin Schlemmer wrote: |
2 |
|
3 |
> On Tue, 2003-05-06 at 11:40, Wout Mertens wrote: |
4 |
> |
5 |
> > How about subscribe? And you can ask to be called before and/or after the |
6 |
> > script you subscribe to: |
7 |
> > |
8 |
> > subscribe after net.ppp0 |
9 |
> > |
10 |
> > event() { |
11 |
> > case $2 in |
12 |
> > start|restart) |
13 |
> > start |
14 |
> > ;; |
15 |
> > stop) |
16 |
> > stop |
17 |
> > ;; |
18 |
> > esac |
19 |
> > } |
20 |
> > |
21 |
> > This would make runscript call ddclients event() after net.ppp0 was run, |
22 |
> > with $1 set to the script, $2 set to the action and $3 set to before or |
23 |
> > after. |
24 |
> > |
25 |
> |
26 |
> Well, if you need to start something before, you can just use 'use', or |
27 |
> 'before/after'. |
28 |
> |
29 |
> I think what he wants, and what will be a unique addition, is being able |
30 |
> to tell a script: If you start successfully, start 'foobar' |
31 |
|
32 |
That's what I meant: when the service is called for an action (start, |
33 |
stop, restart, reload, custom things), runscript will run the event() |
34 |
function for all the scripts that are subscribed to that script, and then |
35 |
those scripts can figure out what to do with it themselves... |
36 |
|
37 |
And the gentoo-net scripts that I am working on will go down a |
38 |
user-configurable list when certain things happen. (interface up/down, ip |
39 |
address changed, etc. |
40 |
|
41 |
The design pattern we're looking at here is events and interested parties, |
42 |
and it's just a matter of defining what events we handle and how we notify |
43 |
the parties. |
44 |
|
45 |
Wout. |
46 |
|
47 |
-- |
48 |
gentoo-dev@g.o mailing list |