21 lines
681 B
Bash
Executable File
21 lines
681 B
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
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"
|
|
fi
|
|
|