2017-02-07 02:33:20 -06:00
|
|
|
#!/bin/bash
|
2018-03-17 02:43:29 -05:00
|
|
|
|
2018-06-20 14:15:09 -05:00
|
|
|
# Determine whether stdout is on a terminal
|
|
|
|
if [ -t 1 ] ; then
|
|
|
|
# Prepare a function to send HUP signal to vtysh in the container
|
|
|
|
# we mark the new instance of vtysh with the current tty as a tag
|
|
|
|
TTY=$(tty)
|
|
|
|
function cleanup
|
|
|
|
{
|
|
|
|
docker exec -i bgp pkill -HUP -f "vtysh $TTY"
|
|
|
|
}
|
|
|
|
trap cleanup HUP
|
|
|
|
docker exec -ti bgp vtysh "$TTY" "$@"
|
|
|
|
else
|
|
|
|
docker exec -i bgp vtysh "$@"
|
|
|
|
fi
|