From 6b8e34055840e4e25a4e31156ee0c5c4955f04f2 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 16 May 2018 14:32:42 -0700 Subject: [PATCH] [dhcp_relay] Only attempt to start 'isc-dhcp-relay' group if it is not empty (#1713) --- dockers/docker-dhcp-relay/start.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index 2ee80c4e3388..0ac5ea1a10ec 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -6,13 +6,16 @@ rm -f /var/run/rsyslogd.pid # Start rsyslog supervisorctl start rsyslogd -# Wait for all interfaces to come up and be assigned IPv4 addresses before -# starting the DHCP relay agent(s). If an interface the relay should listen -# on is down, the relay agent will not start. If an interface the relay should -# listen on is up but does not have an IP address assigned when the relay -# agent starts, it will not listen or send on that interface for the lifetime -# of the process. -/usr/bin/wait_for_intf.sh +# If our supervisor config has entries in the "isc-dhcp-relay" group... +if [ $(supervisorctl status | grep -c "^isc-dhcp-relay:") -gt 0 ]; then + # Wait for all interfaces to come up and be assigned IPv4 addresses before + # starting the DHCP relay agent(s). If an interface the relay should listen + # on is down, the relay agent will not start. If an interface the relay + # should listen on is up but does not have an IP address assigned when the + # relay agent starts, it will not listen or send on that interface for the + # lifetime of the process. + /usr/bin/wait_for_intf.sh -# Start the DHCP relay agent(s) -supervisorctl start isc-dhcp-relay:* + # Start all DHCP relay agent(s) + supervisorctl start isc-dhcp-relay:* +fi