2019-07-26 16:31:56 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-07-12 02:22:48 -05:00
|
|
|
|
|
|
|
if [[ "$(sonic-cfggen -d -v BGP_DEVICE_GLOBAL.STATE.tsa_enabled)" == "true" ]]; then
|
|
|
|
echo "System is already in Maintenance"
|
|
|
|
logger -t TSA -p user.info "System is already in Maintenance"
|
|
|
|
else
|
|
|
|
# toggle the mux to standby if dualtor and any mux active
|
|
|
|
if
|
|
|
|
[[ "$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype | tr [:upper:] [:lower:])" == *"dualtor"* ]] &&
|
|
|
|
[[ $(show mux status | grep active | wc -l) > 0 ]];
|
|
|
|
then
|
|
|
|
logger -t TSA -p user.info "Toggle all mux mode to standby"
|
|
|
|
sudo config mux mode standby all
|
|
|
|
fi
|
|
|
|
|
|
|
|
/usr/bin/TS TSA
|
|
|
|
echo "Please execute 'config save' to preserve System mode in Maintenance after reboot or config reload"
|
2022-01-24 20:50:29 -06:00
|
|
|
fi
|
|
|
|
|