Skip to content

Commit

Permalink
Manually send SIGHUP to vtysh when the current session was disconnect…
Browse files Browse the repository at this point in the history
…ed (#1801)

* Manually send SIGHUP to vtysh when the current session was disconnected

* Address comments
  • Loading branch information
pavel-shirshov authored Jun 20, 2018
1 parent d82db79 commit bbca583
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
15 changes: 14 additions & 1 deletion dockers/docker-fpm-frr/base_image_files/vtysh
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#!/bin/bash

docker exec -i bgp vtysh "$@"
# 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
15 changes: 14 additions & 1 deletion dockers/docker-fpm-quagga/base_image_files/vtysh
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#!/bin/bash

docker exec -i bgp vtysh "$@"
# 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

0 comments on commit bbca583

Please sign in to comment.