Skip to content

Commit d72a43d

Browse files
authored
#1 System (kernel) timeouts may be very long (> 2 minutes). So the timeout will now be set explicitly to 30 seconds, i.e. if server is unavailable then wait only 1 minute for connecting (2 attempts).
1 parent 69747f7 commit d72a43d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: multi_server_stats.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
fi
2121
if ! [[ -z "$PASS" ]];
2222
then
23-
CURR="$(sshpass -p $PASS ssh -p $PORT -tt -no StrictHostKeyChecking=accept-new $USER@$IP 'vnstat --json h 2' | jq '.interfaces[0].traffic.hour[0].tx')" # first try ...
23+
CURR="$(sshpass -p $PASS ssh -p $PORT -tt -o ConnectTimeout=30 -no StrictHostKeyChecking=accept-new $USER@$IP 'vnstat --json h 2' | jq '.interfaces[0].traffic.hour[0].tx')" # first try ...
2424
if [[ -z "$CURR" ]]; # ... if not successful ...
2525
then
26-
CURR="$(sshpass -p $PASS ssh -p $PORT -tt -no StrictHostKeyChecking=accept-new $USER@$IP 'vnstat --json h 2' | jq '.interfaces[0].traffic.hour[0].tx')" # ... do the second try to eliminate possible intermittent connection problem
26+
CURR="$(sshpass -p $PASS ssh -p $PORT -tt -o ConnectTimeout=30 -no StrictHostKeyChecking=accept-new $USER@$IP 'vnstat --json h 2' | jq '.interfaces[0].traffic.hour[0].tx')" # ... do the second try to eliminate possible intermittent connection problem
2727
fi
2828
if ! [[ -z "$CURR" ]];
2929
then

0 commit comments

Comments
 (0)