:: Re: [DNG] Apparently Jessie has run…
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Steve Litt
Datum:  
To: dng
Betreff: Re: [DNG] Apparently Jessie has runit
On Wed, 20 Jan 2016 21:00:12 +0000
Simon Hobson <linux@???> wrote:

> Rainer Weikusat <rainerweikusat@???> wrote:
>
> > The commands which are actually executed via these S- and K-links
> > come from individual packages and ultimatively contain whatever the
> > people responsible for that considered sensible. Which is usually a
> > pretty arbitrary assortment of more or less useless code which
> > accumulated over ca 20 years in the course of "whatever, the
> > easiest way to make the problem go away is hack some more code into
> > the init script".
>
> My impression from occasionally having to debug some startup issue is
> that the scripts I see aren't all that bad. I can't speak for other
> distros as most of my systems are Debian, but they mostly seem to be :
> - Some headers to tell utilities what runlevels the service should
> run at, and dependencies.
> - A ". include" to pull in some standard functions - makes sense, no
> point everyone building their own wheel.
> - Check for, and if found, load a config file -
> eg /etc/default/${service}
> - Start/Stop/whatever the service


This is what I meant. Headers, includes, and
then /stop/start/restart/whatever sections. Not easy to trace what's
going on. Now consider the ./run script for my new reminder_check
daemon, which I wrote in Python:

======================================================
#!/bin/sh
cd /d/at/python/littcron
export TERM=xterm
export XAUTHORITY=/home/slitt/.Xauthority
export XDG_RUNTIME_DIR=/tmp/1000-runtime-dir
export DISPLAY=:0.0

exec /usr/bin/chpst
-uslitt /d/at/python/reminder_check/reminder_check.py
======================================================

That's it. The four export lines enable the daemon to pop up GUI
(Python tkinter) windows, and are not necessary otherwise. The final
line runs reminder_check.py as user slitt. If I were logging this
daemon, I'd need a line to redirect reminder_check.py's stdout and
stderr together, and then in the log directory under this one I'd need
a 3 line run script that's the same for almost all log files.

My reminder_check service also executes a ./finish script when it
finishes, so if it crashes I'm made aware. The ./finish script follows:

======================================================
#!/bin/sh
export TERM=xterm
export XAUTHORITY=/home/slitt/.Xauthority
export XDG_RUNTIME_DIR=/tmp/1000-runtime-dir
export DISPLAY=:0.0

cat finishmessage.txt | /usr/bin/python3 /d/bats/warnform.py &
======================================================

In the preceding, warnform.py is a generic very loud and visible
warning window producer that enunciates whatever comes into its stdin
or the file in its argument. You could just as easly use the following
command:

roxterm -e 'dialog --msgbox "Reminder checker crashed" 10 30'

But I made my own GUI form out of Python.

[snip]

> Very likely. Except that with systemd it's going to have a lot
> obfuscated in C.


Just in case I wasn't clear enough: Although I don't like sysvinit and
OpenRC, my problems with them pale in comparison to my problems with
the everything-welded-together, no-user-serviceable-parts-inside
architecture of systemd.

SteveT

Steve Litt
January 2016 featured book: Twenty Eight Tales of Troubleshooting
http://www.troubleshooters.com/28