bug-hurd
[Top][All Lists]
Advanced

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

A suggestion for `/servers/socket/2'


From: Thomas Schwinge
Subject: A suggestion for `/servers/socket/2'
Date: Mon, 9 Apr 2007 00:17:02 +0200
User-agent: Mutt/1.5.11

Hello!

`/servers/socket/2' has a passive translator setting, which means that
the `pfinet' running on that node will be started automatically as the
node is accessed -- accessed by using the glibc socket api, for example.
This also means that it will automatically be restarted should it have
crashed.  Getting `pfinet' to crash can be provoked as easily as setting
the system time while it is running.  So far, so good.

But now, there is one problem.  Say you start a ssh server.  It binds its
listening socket by using the `pfinet' server, starting it first, if
needed.  Now consider that this `pfinet' server will crash somewhen
later.  Okay, it has crashed, but no problem: it has a passive translator
setting and will be restarted as soon as it's needed again.  But: the ssh
daemon (and other daemons as well, of course) are not informed that they
have to re-bind their listening sockets to the new `pfinet' server!  They
will eventually try to make use of the old socket descriptors, notice
that they're not accessible anymore and terminate themselves.  And the
usual Debian daemon infrastructure does not make arrangements to restart
a crashed server, so -- until we have something better, a proper service
monitoring -- I propose the following:

Store the following in `/root/restart_networking_services' or somewhere
else and make it executable.

#v+
#!/bin/sh

exec > /dev/null 2>&1

trap "sh -c 'while ! stat -L /servers/socket/inet; do sleep 1; done' &" EXIT

# Extend this list to contain all daemons that set up listening sockets.
for s in \
  inetutils-inetd \
  nullmailer \
  ssh \
  ;
do
  test -x /etc/init.d/"$s" && /etc/init.d/"$s" restart &
done

"$@"
#v-

Then (once) run the following:

#v+
$ sudo settrans -pgf /servers/socket/2 /root/restart_networking_services 
`showtrans /servers/socket/2`
#v-

(This may leave your system in a non-networked state, so better do that
from a console login.)


After having done the above, be happy that each time the `pfinet' server
is (re-)started, all daemons that set up listening sockets will also be
restarted and as well be happy that each time the `pfinet' server has
exited it will automatically be restarted.


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]