Jpp  master_rocky-43-ge265d140c
the software that should make you happy
JControlHostSSHTunnel.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 #
4 # \author mdejong
5 #
6 version=1.0
7 script=${0##*/}
8 
9 # ------------------------------------------------------------------------------------------
10 #
11 # Utility script to test JControlHost/JLigier through ssh tunnel.
12 #
13 # ------------------------------------------------------------------------------------------
14 
15 
16 if [ -z $JPP_DIR ]; then
17  echo "Variable JPP_DIR undefined."
18  exit
19 fi
20 
21 
22 source $JPP_DIR/setenv.sh $JPP_DIR
23 
24 
25 set_variable DEBUG 3
26 
27 if do_usage $*; then
28  usage "$script <host name>"
29 fi
30 
31 case $# in
32  1) set_variable SERVER $1;;
33  *) usage "$script <host name>"
34 esac
35 
36 
37 if (( 1 )); then
38 
39  set_variable PORT 5553
40  set_variable SOCKET my-ctrl-socket
41 
42  JLigier.sh ${SERVER} continue
43 
44  echo "Create ssh tunnel."
45 
46  ssh -S ${SOCKET} -fN -M 0 -L ${PORT}:${SERVER}:${PORT}
47 
48  ./JControlHost -H :${PORT} -d3
49 
50  echo "Delete ssh tunnel."
51 
52  ssh -S ${SOCKET} -O exit ${SERVER}
53 
54 fi