#!/bin/bash
grep ucarp-vip /etc/network/interfaces | awk '{print $2}' | while read ip; do
  if ! ps -ef | grep '/usr/sbin/ucarp' | grep $ip >/dev/null; then
    echo "no ucarp process is running for ip $ip"
    exit 2
  fi
done

#!/bin/bash

ifquery --list | \
while read IFACE; do
  ifquery ${IFACE} | \
  awk '/^ucarp-vip:/ {print $2}' | \
  while read VIP; do
    if ! ps -ef | grep '/usr/sbin/ucarp' | grep ${VIP} >/dev/null; then
      echo "no ucarp process is running for IP ${VIP}"
      exit 2
    fi
  done
done

Fix uCARP process check when there are no uCARP interfaces
Fix uCARP process check when there are no uCARP interfaces

Switch to using ifquery rather than reading /etc/network/interfaces
directly so we can check uCARP interfaces defined in interfaces.d as
well.
