diff --git a/plist b/plist index 2983f495e..9af238b51 100644 --- a/plist +++ b/plist @@ -127,8 +127,7 @@ /usr/local/etc/rc.syshook.d/early/10-configd /usr/local/etc/rc.syshook.d/early/15-templates /usr/local/etc/rc.syshook.d/early/20-backup -/usr/local/etc/rc.syshook.d/early/98-carp_maintenance -/usr/local/etc/rc.syshook.d/early/99-carp_service_status +/usr/local/etc/rc.syshook.d/early/90-carp /usr/local/etc/rc.syshook.d/monitor/10-dpinger /usr/local/etc/rc.syshook.d/start/10-newwanip /usr/local/etc/rc.syshook.d/start/20-freebsd diff --git a/src/etc/rc.syshook.d/early/90-carp b/src/etc/rc.syshook.d/early/90-carp new file mode 100755 index 000000000..47c9d4e0b --- /dev/null +++ b/src/etc/rc.syshook.d/early/90-carp @@ -0,0 +1,17 @@ +#!/bin/sh + +# when virtualip_carp_maintenancemode is set, make sure we startup in demoted state +if [ -f /conf/config.xml ]; then + IS_MNT=$(grep -c virtualip_carp_maintenancemode /conf/config.xml) + IS_DEMOTED=$(/sbin/sysctl net.inet.carp.demotion | /usr/bin/awk '{print $2;}') + if [ ${IS_MNT} -gt 0 ] && [ ${IS_DEMOTED} -eq -0 ]; then + /sbin/sysctl net.inet.carp.demotion=240 + fi +fi + +# Trigger carp service status event. When any of the checks in +# /usr/local/etc/rc.carp_service_status.d/ fail, net.inet.carp.demotion +# is updated to prevent switching to master too early + +echo -n "CARP event system: " +configctl interface update carp service_status diff --git a/src/etc/rc.syshook.d/early/98-carp_maintenance b/src/etc/rc.syshook.d/early/98-carp_maintenance deleted file mode 100755 index 9bb3a1771..000000000 --- a/src/etc/rc.syshook.d/early/98-carp_maintenance +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# when virtualip_carp_maintenancemode is set, make sure we startup in demoted state -if [ -f /conf/config.xml ]; then - IS_MNT=`grep -c virtualip_carp_maintenancemode /conf/config.xml` - IS_DEMOTED=`/sbin/sysctl net.inet.carp.demotion | /usr/bin/awk '{print $2;}'` - if [ $IS_MNT -gt 0 ] && [ $IS_DEMOTED -eq -0 ]; then - /sbin/sysctl net.inet.carp.demotion=240 - fi -fi diff --git a/src/etc/rc.syshook.d/early/99-carp_service_status b/src/etc/rc.syshook.d/early/99-carp_service_status deleted file mode 100755 index 5734c9fb1..000000000 --- a/src/etc/rc.syshook.d/early/99-carp_service_status +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Trigger carp service status event. -# When any of the checks in /usr/local/etc/rc.carp_service_status.d/ fails, net.inet.carp.demotion is updated -# to prevent switching to master too early - -configctl interface update carp service_status