[systemd-devel] does "Before=network.target" really work

Michael Hirmke mh at mike.franken.de
Fri Jun 24 10:22:00 UTC 2016


Hi Xin,

>Hi,

>I have a service, and want it to be stopped only after network is
>stopped when system shutdown.

>I checked "man systemd.special ", network is a special internal
>service for systemd, , and I found "network.target":
>"at shutdown, a unit that is ordered after network.target will be
>stopped before the network -- to whatever  level it might be set up
>then -- is shut down".
>That means "After=network.target" can work well.

>But my situation is opposite to that, I need "a unit that is ordered
>before network.target will be stopped *after* the network so
>shutdown".

>So I added "Before=network.target" to .service file. can it really
>work as I expect?

it depends on what you're trying to do with this information.
AFAIK network.target is related to the network stack as such. It does
not apply to a certain interface is up, down, activated or deactivated.
If you need the information for the network stack being up or down,
the use of network.target is ok - and works for me.

>Thanks

Bye.
Michael.
-- 
Michael Hirmke


More information about the systemd-devel mailing list