Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bcmsh]: add inactivity timeout for bcmsh (default 300 seconds) #1921

Merged
merged 1 commit into from
Aug 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions platform/broadcom/docker-syncd-brcm/bcmsh
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
#!/bin/bash
usage="$(basename "$0") [-h] [-q] -- interactive shell for bcm service
usage="$(basename "$0") [-h] [-q] [-t timeout] -- interactive shell for bcm service

where:
-h show this help text
-t inactivity timeout in seconds (default 300 seconds, 0 for no timeout)
-q quite, no banner (default: verbose)"

banner="Press Enter to show prompt.
Press Ctrl+C to exit.
NOTICE: Only one bcmsh or bcmcmd can connect to the shell at same time.
"

# Default verbose
quiet=false
timeout=300

while getopts 'hq' option; do
while getopts 'hqt:' option; do
case "$option" in
h) echo "$usage"
exit
;;
q) quiet=true
;;
t) timeout=$OPTARG
;;
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
Expand All @@ -31,5 +36,5 @@ if [ "$quiet" = false ]; then
echo "$banner"
fi

/usr/bin/socat readline UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket
/usr/bin/socat -T$timeout readline UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket