Re: Systemd service unit file needs to wait until a specific interface is up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



In article <004E8170-E842-4E8B-9623-DB3EA236DE9F@xxxxxxxxxxx>,
Carlos Lopez <clopmz@xxxxxxxxxxx> wrote:
> Hi all,
> 
> 
> With SystemD, how can I make certain service dependent on certain network interfaces being up?
> 
> For example, I have an 802.1ad bond interface I need to wait on for being up (this interface has no ip address assigned,
> it is used to capture networks packets with a tcpdumpâ??s script). Every time this service fails because bond interface
> is not up.
> 
> 
> 
> I have configured the service as:
> 
> 
> 
> [Unit]
> 
> Description=tcpdump capture script
> 
> After=network.target
> 
> Wants=network-online.target
> 
> 
> 
> But it doesnâ??t work â?¦. Any tip or trick?

Just add a line to the tcpdump script to wait for the interface.

Something like this:

until ifconfig -s | grep -q '^bond0' ; do sleep 1 ; done

Cheers
Tony
-- 
Tony Mountifield
Work: tony@xxxxxxxxxxxxx - http://www.softins.co.uk
Play: tony@xxxxxxxxxxxxxxx - http://tony.mountifield.org
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux