8058550c09
TSA/B/C scripts invoke commands that require root permissions. If the user does not have sudo permissions, the scripts today execute until the command and throw a backtrace with error at the specific command. Added a check to ensure the operations check for root permissions upfront.
26 lines
505 B
Bash
Executable File
26 lines
505 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Restrict command to sudo users
|
|
if [ "$EUID" -ne 0 ] ; then
|
|
echo "Root priveleges are needed for this operation"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f /etc/sonic/chassisdb.conf ]; then
|
|
if [[ $1 == "no-stats" ]]; then
|
|
rexec all -c "sudo TSC no-stats"
|
|
else
|
|
rexec all -c "sudo TSC"
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
/usr/bin/TS TSC
|
|
[[ $1 != "no-stats" ]] && portstat -p 5
|
|
|
|
if [[ "$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype | tr [:upper:] [:lower:])" == *"dualtor"* ]]
|
|
then
|
|
echo
|
|
show mux status
|
|
fi
|