:: Re: [DNG] powerdns upstream has dro…
Página Principal
Delete this message
Reply to this message
Autor: tito
Data:  
Para: dng
Assunto: Re: [DNG] powerdns upstream has dropped sysvinit support
On Fri, 13 Oct 2023 09:09:51 -0400
Steve Litt <slitt@???> wrote:

> tito via Dng said on Thu, 12 Oct 2023 08:38:51 +0200
>
> >Hi,
> >
> >I would suggest instead rather than orphan-sysvinit-scripts, s6
> >scripts, runit scripts, who knows scripts... to create a collection of
> >definition files per service with the needed variables
>
> Let's kick this around a little bit...
>
> >(needs, provides,
>
> Those are kind of meaningless in runit although I'm pretty sure they're
> vital in systemd, sysvinit, and I think s6 if you do s6 the new way. So
> for runit and old-school s6, "needs" and that systemd "startafter" and
> "startbefore" stuff boil down to "what needs to be running before this
> daemon starts?" And unlike systemd and the new s6, the already started
> dependency daemon hasn't set a flag saying it's running, nor has it
> (for sysvinit) backgrounded itself to say it's running. Instead, in
> runit you test for the dependency being running. For instance, if the
> dependency is the network, you can ping 8.8.8.8 and if it fails, exit 1
> and let runit try again in a second or five or whatever.


# TEST NETWORK
NETWORK=$(printf "GET /nm HTTP/1.1\\r\\nHost: network-test.debian.org\\r\\n\\r\\n" | nc -w1 network-test.debian.org 80 | grep -c "NetworkManager is online")
if test "$NETWORK" -ne 1 ; then
    NETWORK=$(printf "GET /ncsi.txt HTTP/1.1\\r\\nHost: www.msftncsi.com\\r\\n\\r\\n" | nc -w1 www.msftncsi.com 80 | grep -c "Microsoft NCSI")
    if test "$NETWORK" -ne 1 ; then
        echo "Your network seems to be down. "
        echo "Cannot connect to the Internet. Exiting..."
        exit 1
    fi
else
    echo "Network Connectivity Status: OK"
fi


OTOH maybe network is to be intended as device lo
so that just 127.0.0.1 is up as you cannot have
a guarantee that the box is even connected to the
network

or it is to be intended as bring up all interfaces
in /etc/network/interfaces?

I think it would be easier to assume that due to "needs" and "provides"
the ordering was done the correct way and when it is your time
to run your "needs" did start, if there was an error e.g. the network cable
was pulled there is nothing you could do, the daemon could be started the
same and just sit there and wait and retry or exit after a few tries
depending on how it was coded.

> This "test" method sounds like a kludge, but it's actually better
> because it tests what you need, not what the daemon said when it
> supposedly became effective. If you need MariaDB running, you can test
> with a read for a table you know is in a known database, instead of


The SHOW SCHEMAS is an alternative MySQL command to view databases on a server host.
SHOW SCHEMAS; Similar to MySQL SHOW DATABASES statement, SHOW SCHEMAS can be
run from MySQL Command Line Client, MySQL Shell

> hoping systemd's right about saying that it's running. So in the tito
> file you need test scripts for each dependency, and each test script is
> probably about 1 to 3 lines, but they are code, not key value pairs.


Could be made key value pairs e.g.:
NETWORK=$(printf "GET /nm HTTP/1.1\\r\\nHost: network-test.debian.org\\r\\n\\r\\n" | nc -w1 network-test.debian.org 80 | grep -c "NetworkManager is online")

> Another situation is where you must shut down one daemon before
> shutting down another. I think the usual example of this is you must
> shut down your database before shutting down nfs. Any such relationship
> must be in the tito file.
>
> >daemon, options to run in foreground, options to run
> >in background, options to log, options for pidfile, run as user, run
> >as group,
>
> I think you've pretty much covered it, unless you want it to enable one
> to create a unit file from the tito file, but that decision would be
> political and strategic, seeing as the unit files will always be
> available until systemd goes away.


> By the way, I'm pretty sure that if each "must start A before starting
> B" and each "must kill C before killing D" is listed in the tito file,
> sysvinit S and K numbers can be calculated. I think the make program
> might be helpful in doing this.


Couldn't LSB init script headers used for this? In the last or previous debian
versions this work was already done.

> SteveT
>
> Steve Litt
>
> Autumn 2023 featured book: Rapid Learning for the 21st Century
> http://www.troubleshooters.com/rl21

Ciao,
Tito