#! /bin/sh
# This shuts down all switch ports quickly when the system reboots.
# This is only done on reboot, shutdown, halt, and poweroff, otherwise
# do nothing

# Invoked from the cumulus-fastfailover.service
systemctl list-jobs | egrep -q '(shutdown|reboot|halt|poweroff)\.target' || \
    exit 0

echo 1 > /cumulus/switchd/ctrl/shutdown_linkdown

#Disable Clagd service on reboot.
/bin/systemctl -q disable clagd.service
/usr/bin/killall -q -s 37 clagd || exit 0

exit 0
