Tool to parse systemd unit files
Jesse Smith
jessefrgsmith at yahoo.ca
Tue Sep 24 23:28:30 BST 2019
> So if you keep separeted the code that parse and extract all the info that
> are needed for a service and the part that write to a sysv template, I think
> I will use your parsing tool instead of my
> already-messy-bash-parsing-engine,
That sounds good. I am trying to keep the code which parses units, and
the code which works out dependencies used by those units, modular. The
code is all written in C and I'm hoping to develop it as a toolkit that
can be used to do a variety of things. Once I test it some more and get
more of the code interface commented, I'll make it publicly available.
> But I'm curious, systemd unit usually start a process in foreground, while
> Sysv wants to background a process: how are you dealing with this?
I think this is a bit of a misnomer. SysV init doesn't care if a process
was started as a background/parallel process, or if it's run as a
serial/foreground process. The scripts usually run services in the
background so they can exit right away, but this isn't a requirement or
preference of SysV.
systemd can run units as foreground or forking/background processes, it
doesn't really care either. It just changes the way it terminates/reaps
daemons.
So, in short, I don't need to do anything to deal with this. It doesn't
affect script translation or processing dependencies. If I make a
service manager out of the library then I can use a unit's preference
for foreground/background to determine how children are reaped, but it's
not a requirement.
- Jesse
More information about the Debian-init-diversity
mailing list