:: Re: [DNG] does systemd set runlevel…
Inizio della pagina
Delete this message
Reply to this message
Autore: tilt!
Data:  
To: dng
Oggetto: Re: [DNG] does systemd set runlevel 0 in utmp on shutdown?
Hello Tobias,

thanks a lot for these hints! Please understand the following questions not
directed specifically to you, it's just that I am not very much into
systemd,
and i appreciate every piece of clarification a lot. I post this here,
because
this is one forum I know that cares about portability between
*different* init
systems, and that's just what i would like to ensure for my nodm patch
before
proposing it anywhere.

On 08/29/2015 02:13 AM, Tobias Hunger wrote:
> The systemd 217 announcement contained something about utmp support being
> compile time optional to have legacy free systems. So I would not

depend on
> that service.


That makes things difficult: With systemd 217 or later installed,

(1) if utmp is there (it's in POSIX), but the utmp support (being optional)
is not there, will utmp simply remain not updated?

(2) If the answer to (1) was "yes" then, how to determine if I am
dealing with
an utmp that is not actually being maintained but just remains there as
sort of
a compatibility placeholder (again, it's in POSIX)? Check for installed
systemd
and its version being >= 217?

(3) In the light of questions (1) and (2), does systemd care about POSIX
at all?

> I do not think you would need it anyway as systemd will stop the display
> manager all by itself.


Given the unclarity I tried to express in my previous questions, i admit
that i
am currently not too confident about that. Just to be on the safe side:

(4) Am I right in understanding that the systemd way of determining if a
system
is in shutdown is to check for a special target "shutdown.target" in the
list
of "jobs"? Searching the web, I find shellscript examples using the
"systemctl"
service executable, something along the lines of

/usr/bin/systemctl list-jobs | egrep -q 'shutdown.target.*start' &&
        echo "shutting down" ||
        echo "not shutting down"


Is there a C API for that, too? I could of course dissect systemctl, as
I have
done with the sysvinit utilities, but i have yet to find the time to do so.

Kind regards,
T.