Skip to content

Commit 18ee27e

Browse files
committed
[bcmsh]: add inactivity timeout for bcmsh (default 300 seconds)
Signed-off-by: Guohan Lu <[email protected]>
1 parent 0cd4ef0 commit 18ee27e

File tree

1 file changed

+8
-3
lines changed
  • platform/broadcom/docker-syncd-brcm

1 file changed

+8
-3
lines changed

platform/broadcom/docker-syncd-brcm/bcmsh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
#!/bin/bash
2-
usage="$(basename "$0") [-h] [-q] -- interactive shell for bcm service
2+
usage="$(basename "$0") [-h] [-q] [-t timeout] -- interactive shell for bcm service
33
44
where:
55
-h show this help text
6+
-t inactivity timeout in seconds (default 300 seconds, 0 for no timeout)
67
-q quite, no banner (default: verbose)"
78

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

1214
# Default verbose
1315
quiet=false
16+
timeout=300
1417

15-
while getopts 'hq' option; do
18+
while getopts 'hqt:' option; do
1619
case "$option" in
1720
h) echo "$usage"
1821
exit
1922
;;
2023
q) quiet=true
2124
;;
25+
t) timeout=$OPTARG
26+
;;
2227
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
2328
echo "$usage" >&2
2429
exit 1
@@ -31,5 +36,5 @@ if [ "$quiet" = false ]; then
3136
echo "$banner"
3237
fi
3338

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

0 commit comments

Comments
 (0)