:: [DNG] Networking, dependencies, res…
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Steve Litt
Ημερομηνία:  
Προς: dng
Αντικείμενο: [DNG] Networking, dependencies, restarting
Hi all,

Right now, on the debian-user mailing list, they're wringing their
hands about restarting the network and how Debian apparently gets it
wrong, I guess because of stuff like you need a link before assigning
an IP, you need an IP before doing DNS, you need DNS before NFS,
Samba, Apache and who knows what else. And I think they're also having
problems with recognizing the right network device names, which of
course was solved on this mailing list a couple months ago.

LOL.

First of all, it's ironic that if I had credible information on startup
ordering, and if I used systemd, I could *easily* get all this to
happen. Systemd's Unit files with targets and the like are straight up
built for this exact multiple ordering thing.

Similarly, I could get this to happen on Runit or S6, with generic
dependencies. It appears that the Debian Devs are doing their systemd
with a sysvinit accent. Worst of both worlds.

OK, I'll stop with my gleeful "I told you so" taunt, and get to my
real message...

In my personal opinion, you can't make a distro for every use case, for
ever event. And the more you try to get those last couple percent to
work, the bigger and messier the system becomes.

I think the best way to get that last couple percent is with
documentation and shellscripts. This works because generally speaking,
the people with use cases that break the normal distro methods are
informed enough to read docs and modify shellscripts. So for instance,
on a machine that just assigns a static IP address and gateway, you
might use a shellscript something like this:

===========================================
#!/bin/sh
hostname -F /etc/hostname
ip link set dev lo up
ip link set dev $eth down
ip addr add 192.168.100.88/24 dev $eth
ip link set dev $eth up
ip route add default via 192.168.100.96

if ping -c1 192.168.100.96; then
start_nfs.sh
start_samba.sh
start_apache.sh
start_smtp_server.sh
fi
===========================================

In the preceding, the value of $eth would have already been determined
by the device name finding shellscript described a few months ago on
this mailing list. The ping -c1 192.168.100.96 is how you prove you
have network connectivity. In reality, that and all the start_*.sh
scripts would have probably been scripts that left evidence of their
starting or failure somewhere.

A slightly more sophisticated version of the preceding script would
probably start up the network and everything needing it. And when it
comes time to stop the network, it could be something like this:

==========================================
stop_smtp_server.sh
stop_apache.sh
stop_samba.sh
stop_nfs.sh
if dependent_services_really_stopped.sh; then
ip link set dev $eth down
==========================================

A restart is just a stop and subsequent start.

Here's my point: For 98% of all users, starting and stopping via
sysvinit, you know, what we and Debian have right now, works just fine.
But for those edge cases, rather than building ever more IF statements
into ever huger init scripts, why not document a few skeleton
shellscripts that can be custom modified to do *exactly* what's needed
in the (presumably sophisticated) user's case?

SteveT

Steve Litt
March 2016 featured book: Quit Joblessness: Start Your Own Business
http://www.troubleshooters.com/startbiz