[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rc



# This might script that logs via ssh user init/root, and run correct command.
# Or just a packet via net, but then all auth is our task to do.

*nod*
 
# Simpliest and portable way is making socket or fifo somewhere in /dev/*.
# user init/root group init/root.

I considered this - /dev/scm, or /dev/init, perhaps. It seems that it's
probably the best way to go.

# Or at constant udp or tcp address, but then we need to do all auth ourselves :-(.
# One would just send packet (udp ?) like this :
# 
# struct service_control {
#   int action_nr;
#   char service[256];  
# }

This works (even if this is what we stuff down a fifo, instead of in a udp
packet). We need to handle return results too, of course, but that's
pretty trivial once we figure out how we're going to communicate ;)

# Suggostion : we need to consider service stopping before implementing anything.
# In particular : stopping restarting and config-reloading metaservices
# and services that others depend on.

Hmm. Yes.

We don't want to end up specifying that xfs shutting down requires X to
shut down, but we still want to prevent xfs from shutting down if X is
running.

We want to be able to say:

graphical.start [is] X 
graphical.start [is] bar.stop 
graphical.start [is] baz.restart

gpm.start [before] X.start

X.start [requires] xfs.start
foo.start [requires] xfs.start

xfs.stop [depends on] X.stop
xfs.stop [depends on] foo.stop

So, based on the above rules:

* Tou can't stop xfs unless both X is 'stop' and so is foo.
* You can't start X without starting xfs, but we can do that
  automatically, provided the rules for xfs allow it.
* If starting both gpm and X, gpm should be started before X is.
* Entering the runlevel 'graphical' causes X to be started, 'bar' to be
  stopped if it's started, and baz to be restarted if it's running.

Hmm. It'd be nice if we could say:

graphical.start [is] baz.restart || baz.start

To start baz if it's not running, and restart it otherwise. I don't know
if this is

a) easily do-able, or
b) worthwhile.

I'm not sure if 'restart' should give an error if the service is not
already running. I think perhaps it should (thus the above could be quite
useful).

Also, Perhaps we could re-work the "gpm.start [before] X.start" into:

gpm.start [depends on] X.stop

i.e., don't start gpm unless X is not running

And have init figure out that if we're starting the two at the same time,
then gpm must be started before X. I don't know if this works, or if we'd
need two rules to do almost the same thing.

I'm also assuming that doing:

X.stop

when X is stopped

..won't cause an error. I can't see where it'd make sense for it to do so
(i.e., if service->state == required_state, ignore).

However, this is going to give us one huge-ass mother of a config file on
a real system if we're not careful.

# What if someone make 'svc restart graphical' ?
# Or even worse : 'svc config-reload graphical'.

# Some parts of graphical metaservice can't reload config w/o restarting
# themselves, and others depend on it, so we might end restarting whole X.

Ick. I wasn't actually planning on allowing whole runlevels to be
restarted for this very reason (it seems to have far too wide-reaching
implications that'll give me a headache if I think about them for too
long).

However, we could say:

X.reload [not allowed]

And have..

$ svc X reload
svc: Service 'X' does not support reloading.

We could also say:

xfs.restart [depends on] X.stop

To say that xfs may not be *restarted* if X is running, but may be
reloaded, if there are no [not allowed] rules for it..

X.restart [requires] xfs.restart
xfs.restart [depends on] X.stop

Thus:

$ svc X restart
Stopping X...
Stopping xfs...
Starting xfs...
Starting X...

# We need to invent it, as make doesn't handle such thing at all,
# and I don't know if anything does, so this work will be very ``innovative'' :-)

I've not seen or heard of anything that does something like this to this
extent (replacing /etc/rc with a call to make -f
/etc/rc.d/rc.$RUNLEVEL.mak doesn't really come close ;>). So, yeah..if we
can pull it off, it goes into the 'cool new stuff' basket :)

Phew. That took a while to type out :) 

-- 
Mo McKinlay             Chief Software Architect          inter/open Labs
-------------------------------------------------------------------------
GnuPG Key: pub  1024D/76A275F9 2000-07-22 Mo McKinlay <mmckinlay@gnu.org>









Reply to: