Comment 5 for bug 1488962

Martin Pitt (pitti) wrote :

SysV init scripts don't have enough defined machine parseable semantics to tell what they do. Some just run a few commands (the equivalent of systemd's "Type=oneshot", others fork off a daemon (the equivalent of "Type=forking"). Thus for SysV generated units, systemd defaults to RemainAfterExit=yes as that's the safer default -- not doing so would assume that the SysV script is idempotent. So I'm afraid this default won't/can't be changed in a sensible way.

If you want to improve the behaviour particularly for Apache, then indeed adding native service units would be best. This can then use modern features such as socket activation, which vastly simplifies inter-service dependencies, and avoids running apache unnecessarily. E. g. Fedora does that (http://pkgs.fedoraproject.org/cgit/rpms/httpd.git/tree/ has the units)

If that's too much effort for Xenial, then a simpler way would be to just ship a drop-in `/lib/systemd/system/apache2.service.d/type.conf with "[Service]\nType=forking", so that you just override this one property from the generated unit.