[colug-432] SystemD: long-running NON-forking units?

Rick Hornsby richardjhornsby at gmail.com
Sat Feb 25 13:12:24 EST 2017


On February 25, 2017 at 11:19:25, Joshua Kramer (joskra42.list at gmail.com)
wrote:

Hello,

...


The problem I have is, I can't get SystemD to pause startup while
either of those scripts is running. On startup, SystemD starts the
un-tar job and merrily carries along starting everything else,
including some jobs (i.e. Postgres) that depend on files under /var.
On shutdown, the tar file is truncated because the tar job is not
finished by the time the shutdown target cuts the power.

This is Raspbian. Though eventually I want to do the same thing with
RedSleeve (it's a RHEL6/7 clone that runs on Raspi). Here is what I
have. (Note that I have tried changing the Type to simple.)

While I can't speak to the specific clone you're referring to, RHEL 6 and 7
are different. RHEL 6 uses SysV type init scripts (ala chkconfig), while
RHEL 7 uses systemd style. (RHEL 7 technically sort of supports SysV style,
but it can get kind of bitchy out them sometimes.) RHEL 6 does not support
systemd.

That aside, what you're running into, forgive the expression, is a feature
of systemd - parallel startup. With more memory, more and faster cores,
faster storage, etc there's no good reason things can't start in parallel
greatly speeding up the boot process. It's been some months since I last
messed with a systemd script, but I think to get you down the right path
what you're going to need to do is look at the concepts of dependencies and
maybe targets.

With SysV style scripts, you set the sequence number so that you ended up
with a bunch of symlinks like S10.lpd, S11.ntpd, K99httpd, etc. S for
start, K for kill and they would execute, one at a time (serially), in
numeric/alphabetical order. If you need ntpd to start before lpd (I'm
making these up), you need to change the sequence number (priority?) of lpd
to at least 12, or ntpd to less than 10.

SystemD did away with that in favor of a more flexible system that allows
using explicit dependencies - before, after, requires, wants.

I think this the concept that you're chasing. This post may help explain it
better -

https://fedoramagazine.org/systemd-unit-dependencies-and-order/

HTH-rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20170225/a1029650/attachment.html 


More information about the colug-432 mailing list