supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Network scripting
@ 2004-02-01 13:44 Richard A Downing FBCS
  2004-02-01 18:15 ` Scott Gifford
  0 siblings, 1 reply; 4+ messages in thread
From: Richard A Downing FBCS @ 2004-02-01 13:44 UTC (permalink / raw)


In <http://smarden.org/pape/djb/daemontools/noinit.html>, Gerrit suggests:

"...why not think about eth0 as a service? Let a supervisor garantee the state
of eth0, take it like any other service."

Having moved everything else over to runit, I want to replace my sysvinit
scripts that bring up the ethn interfaces. But I have to admit that I can't
quite see how to do it.

Does anyone have a solution they could share?

-- 
Richard A Downing FBCS http://www.109bean.org.uk/
Anyone sending unwanted advertising e-mail to this address will be
charged $25 for network traffic and computing time. By extracting my
address from this message or its header, you agree to these terms.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Network scripting
  2004-02-01 13:44 Network scripting Richard A Downing FBCS
@ 2004-02-01 18:15 ` Scott Gifford
  2004-02-02  2:15   ` Charlie Brady
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Gifford @ 2004-02-01 18:15 UTC (permalink / raw)
  Cc: supervision

Richard A Downing FBCS <richard@109bean.org.uk> writes:

> In <http://smarden.org/pape/djb/daemontools/noinit.html>, Gerrit suggests:
> 
> "...why not think about eth0 as a service? Let a supervisor garantee the state
> of eth0, take it like any other service."
> 
> Having moved everything else over to runit, I want to replace my sysvinit
> scripts that bring up the ethn interfaces. But I have to admit that I can't
> quite see how to do it.
> 
> Does anyone have a solution they could share?

I do exactly this for eth1 on my fileserver.  Here's my run file:

    #!/bin/sh
    
    exec 2>&1
    
    HOSTNAME=CC312669-A
    DEVICE=eth1
    
    exec /usr/local/sbin/dhcpcd -h "$HOSTNAME" -d -v -a -m "./conf/rc" "$DEVICE"

It's very simple, and it's intuitive (to me anyways) to say svc -d
/service/eth1 to shut down my network connection, svc -t to restart
the DHCP server, etc.

I'm not sure how much sense it would make to use supervise to manage
a static ethernet connection.  The only way I can think of would be to
use a script that set up the interface, then just slept until it
received a TERM signal, at which point it shut the interface down.
Seems kinda silly, but workable.

----ScottG.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Network scripting
  2004-02-01 18:15 ` Scott Gifford
@ 2004-02-02  2:15   ` Charlie Brady
  2004-02-02  8:15     ` Thomas Schwinge
  0 siblings, 1 reply; 4+ messages in thread
From: Charlie Brady @ 2004-02-02  2:15 UTC (permalink / raw)



On Sun, 1 Feb 2004, Scott Gifford wrote:

> Richard A Downing FBCS <richard@109bean.org.uk> writes:
> 
> > In <http://smarden.org/pape/djb/daemontools/noinit.html>, Gerrit suggests:
> > 
> > "...why not think about eth0 as a service? Let a supervisor garantee the state
> > of eth0, take it like any other service."
> > 
> > Having moved everything else over to runit, I want to replace my sysvinit
> > scripts that bring up the ethn interfaces. But I have to admit that I can't
> > quite see how to do it.
> > 
> > Does anyone have a solution they could share?
...
> I'm not sure how much sense it would make to use supervise to manage
> a static ethernet connection.  The only way I can think of would be to
> use a script that set up the interface, then just slept until it
> received a TERM signal, at which point it shut the interface down.

Most easily done with runit rather than daemontools. You'd use 'finish' to 
bring the interface down. For the run script, compile this as "pause":

main()
{
   exit(pause());
}

and have a run script which does:

#! /bin/sh
modprobe eth0
# check preconditions here and wan and exit if not met
ifconfig ...
exec /usr/local/bin/pause

> Seems kinda silly, but workable.

It might make sense if the interface might be DHCP or static configured 
from time to time, and you want a consistent design.

--
Charlie



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Network scripting
  2004-02-02  2:15   ` Charlie Brady
@ 2004-02-02  8:15     ` Thomas Schwinge
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Schwinge @ 2004-02-02  8:15 UTC (permalink / raw)
  Cc: supervision

On Sun, Feb 01, 2004 at 09:15:39PM -0500, Charlie Brady wrote:
> For the run script, compile this as "pause":
> 
> main()
> {
>    exit(pause());
> }

You could also use <URL:http://multivac.cwru.edu./runwhen/rw-sleep/>.

> and have a run script which does:
> 
> #! /bin/sh
> modprobe eth0
> # check preconditions here and wan and exit if not met
> ifconfig ...
> exec /usr/local/bin/pause

[...]
exec rw-sleep -

Regards,
 Thomas


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-02  8:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-01 13:44 Network scripting Richard A Downing FBCS
2004-02-01 18:15 ` Scott Gifford
2004-02-02  2:15   ` Charlie Brady
2004-02-02  8:15     ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).