-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
ssh
executable file
·62 lines (48 loc) · 1.31 KB
/
ssh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/ksh
##
## ssh: Use environment-specific ssh_config(5) in $HOME/.ssh if available
## Copyright (c) 2015 SATOH Fumiyasu @ OSS Technology Corp., Japan
##
set -u
ssh_config="$HOME/.ssh/config"
uname=$(uname)
urel=$(uname -r)
hostname=$(uname -n)
domain=$(sed -n 's/^domain \(.*\)$/\1/p' /etc/resolv.conf)
## ----------------------------------------------------------------------
case "$domain" in
#lan.osstech.co.jp)
# domain="osstech"
# ;;
lan.sfo.jp)
domain="sfo"
;;
esac
## ======================================================================
ssh_config_list=(
"$ssh_config.$hostname"
"$ssh_config.$domain"
"$ssh_config.$uname$urel"
"$ssh_config.$uname"
)
for ssh_config in "${ssh_config_list[@]}"; do
if [[ -f $ssh_config ]]; then
set -- -F "$ssh_config" "$@"
fi
done
## ======================================================================
set -- "/usr/bin/${0##*/}" "$@"
if [ -f /usr/lib/libkeepalive.so ]; then
set -- \
env \
LD_PRELOAD="/usr/lib/libkeepalive.so${LD_PRELOAD:+:$LD_PRELOAD}" \
KEEPIDLE=60 \
KEEPINTVL=30 \
KEEPCNT=3 \
"$@" \
;
fi
## ----------------------------------------------------------------------
## Interpolate `echo BECOME-SUCCESS-*` to avoid confusing Ansible
echo "$$: ${*//echo BECOME-SUCCESS-/echo BECOME-SUCCESS-XXX-}" 1>&2
exec "$@"