sonic-buildimage/files/scripts/sonic-netns-exec

13 lines
232 B
Plaintext
Raw Normal View History

#!/bin/bash
# Wrapper to execute any command in a specific
# network namespace.
# Usage:
# sonic-netns-exec <namespace name> <command to be executed>
NS="$1"
shift
2020-04-07 02:05:47 -05:00
if [ ! -z "$NS" ]; then
ip netns exec $NS "$@"
else
2020-04-07 02:05:47 -05:00
"$@"
fi