[CentOS] CentOS 7, NSF, "feature"

Wed Feb 3 16:04:01 UTC 2016
Ricardo J. Barberis <ricardo at palmtx.com.ar>

El Miércoles 03/02/2016, James Hogarth escribió:
> On 2 Feb 2016 20:19, "Ricardo J. Barberis" <ricardo at palmtx.com.ar> wrote:
> > because the interface wasn't yet up, so I had to make a new unit and put
>
> this
>
> > inside (/etc/systemd/system/nginx.service):
> >
> > <code>
> > .include /usr/lib/systemd/system/nginx.service
> >
> > [Unit]
> > After=network.target remote-fs.target nss-lookup.target
>
> network-online.target
>
> > </code>
> >
> >
> > The After line is the important one, I copied it from
> > /usr/lib/systemd/system/nginx.service and added "network-online.target"
> > at the end.
> >
> > After making your changes, be sure to reenable the service so it takes
>
> your
>
> > new unit, e.g.:
> >
> > # systemctl reenable nginx.service
>
> 1) Don't use .include as that's not recommended and deprecated behaviour.
> Make an override snippet in /etc/systemd/system/nginx.service.d called
> custom.conf or network.conf or something. This has the benefit as well of
> working nicely with systemctl cat and systemd-delta.

Nice to know, I've only used systemd with CentOS 7 so I'm not terribly 
familiar with it, though I read a lot about it on Lennarts's blog.

The .include trick was from systemd 208 IIRC (from CentOS 7.0) but now we have 
systemd 219 (CentOS 7.2) so there's a lot of little new things to learn :)

> 2) You just need a systemctl daemon-reload after this not reenable.
>
> 3) The network targets situation is detailed (and the whys of it) in the
> systemd.special man page.

Cheers,
-- 
Ricardo J. Barberis
Usuario Linux Nº 250625: http://counter.li.org/
Usuario LFS Nº 5121: http://www.linuxfromscratch.org/
Senior SysAdmin / IT Architect - www.DonWeb.com