-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbbl
More file actions
executable file
·61 lines (58 loc) · 1.48 KB
/
bbl
File metadata and controls
executable file
·61 lines (58 loc) · 1.48 KB
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
#!/bin/sh
# ip=$(cat ~/syncthing_main/lan_ip_Linux_bleepblop.txt | head -1)
# ssh -t cottrell@$ip tmux -CC $*
while getopts ":m:-:" opt; do
case ${opt} in
m)
machine=$OPTARG
;;
-)
case "${OPTARG}" in
machine=*)
machine=${OPTARG#*=}
;;
*)
echo "Invalid option: --${OPTARG}" >&2
exit 1
;;
esac
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
shift $((OPTIND-1))
done
machine=${machine:-bleepblop}
# 2021 try the ips in some order and use first that works
for ip in $(tac ~/syncthing_main/lan_ip_Linux_"$machine".txt); do
# 2023-10-21 172.17.0.1 is some docker thing?
if [ $ip = '172.17.0.1' ]; then
echo skipping $ip
continue
elif $(echo $ip | grep -q ':'); then
echo skipping $ip
continue
elif ssh -o ConnectTimeout=1 -t cottrell@$ip echo yes >/dev/null 2>&1; then
if [ $(uname) = 'Darwin' ]; then
cmd="ssh -t cottrell@$ip tmux -CC $*"
echo $ip is ok trying $cmd
$cmd
break # no need to try others
else
xtermcontrol --bg '#300000'
cmd="ssh -X cottrell@$ip $*"
echo $ip is ok trying $cmd
$cmd
xtermcontrol --bg '#000000'
break # no need to try others
fi
else
echo nope $ip
fi
done