#!/bin/sh
# /etc/network/if-up.d/ngcp-eaddress

# Don't bother when lo is configured
if [ "$IFACE" = lo ]; then
  exit 0
fi

# Only run from ifup
if [ "$MODE" != start ]; then
  exit 0
fi

# We only care about inet
if [ "$ADDRFAM" != inet ] ; then
  exit 0
fi

if service mysql status >/dev/null 2>&1 ; then
  echo "Triggering ngcp-eaddress"
  IFACE=$IFACE service ngcp-eaddress start
else
  echo "Skipping ngcp-eaddress as MySQL is not running."
fi
