On Thu, Apr 17, 2008 at 6:02 PM, Jens Persson <[EMAIL PROTECTED]> wrote:
> Buenas noches ppl!
>
> I ran into a little problem on IRC and am a bit clueless so I just pass
> it on to the pros:
>
> <oberon> hi
> <oberon> is there a keyword I can put in an .i file that will prevent a
> daemon from restarting when a daemon is uses/needs restarts ?
> <xerxes2> oberon: i'm not sure what you mean?
> <oberon> when there is a daemon A that uses/needs daemon B - if B
> restarts for whatever reason, A is forced to restart too
> <oberon> I wonder if there is a way to prevent this forced restart
> <xerxes2> hmm, i didnt know that.
> <xerxes2> i'll take it up with ismaell later.
> <xerxes2> sounds just stupid yes.
> <oberon> it's reasonable, but there should be a way to prevent this
> * Anathema` has quit (Read error: 110 (Connection timed out))
> <xerxes2> ok
> <xerxes2> as you said a keyword like "norestart" would solve it.
> <xerxes2> dunno if that exists.
> * fcr-sama has quit (Read error: 104 (Connection reset by peer))
> <oberon> actually there should be two levels of "norestart"
> <oberon> the simpler one is just "norestart;"
> <oberon> the more complex one will accept exceptions
> <xerxes2> hmm ok.
> <oberon> ie, when a daemon depends on A and B, when A restarts you dont
> want to restart, but whn B restarts you *do* want to restart
> <oberon> I'll settle for a simple "norestart;" for now .. :-)
> <xerxes2> ok. :D
> <Ditegen> if A needs B and B restarts: there should be restart handler in A
> <Ditegen> it either restarts or runs the script in restart handler
> <Ditegen> most simple case is A sends itself SIGHUP in the script
> * Anathema` ([EMAIL PROTECTED]) has joined #initng
> * Pix` ([EMAIL PROTECTED]) has joined #initng
> * Pix- ([EMAIL PROTECTED]) has joined #initng
> * Pix has quit (Read error: 110 (Connection timed out))
> * Pix- is now known as Pix
> * Pix` has quit (Read error: 113 (No route to host))
> <oberon> Ditegen, yeah, thats a better idea, but it will take a longer
> time to implement
> <oberon> that's why I said that I'll settle for a simple "norestart" for now
>
> Greets Jens
I see a way to define the restarting... I think you might be barking
at the wrong tree. I think that instead of specifying if a service
should restart or not, we should specify whether a service or daemon
should send a restart chain to its dependants. For this we can
implement a "nochainrestart" (or "restartsfreely") directive. This
would be wonderful for, say, setting up the random number generator
for encryption services. They only need it to run once. It's also
useful for other services that do only on-start setup chores, like the
dkms autoinstaller present in some distros. Actually I tried to
restart it once, and I ended up restarting the whole machine.
The pseudocode for the handling would be (I haven't read the code, so
please forgive me):
service::onstop() {
if(!restartsfreely) {
send_dependency_down_events();
}
}
But let's assume that specifying it on the other end is required. For
this, I propose other directives: "needsonce" and "usesonce" (similar
to php's include_once and require_once directives), which only depends
on the service on startup (i.e. setting up a config file or
something). This way we could specify which services should restart
and which ones shouldn't.
The alternative would be "norestartfor", in which we could list the
services/daemons that we want to restart. If we want to generalize
that, we could use a "*" meaning any.
The pseudocode is pretty simple:
service::ondependencydown(dependencyname) {
if((not dependencyname in [norestartfor] ) and (norestartfor != "*" ) then {
shutdownservice("waiting for dep");
}
}
But I actually don't know how the real code is handled. Anyway, this
is a very interesting subject B-)
--
_______________________________________________
Initng mailing list
[email protected]
http://jw.dyndns.org/mailman/listinfo/initng