1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # IMPORTANT:
|
---|
4 |
|
---|
5 | # This script does NOT close cleanly,
|
---|
6 | # the SSH tunnels will be left active after the script exits!
|
---|
7 |
|
---|
8 | # If you don't have public-key authentication set up for your SSH login,
|
---|
9 | # You won't be able to use this script, because the SSH connections won't be able to login automatically
|
---|
10 | # So either set up public-key authentication, or you can manually start every SSH tunnel and login
|
---|
11 |
|
---|
12 | # You should change the username and hostname to your own username and the hostname of your server
|
---|
13 | username=jts21
|
---|
14 | hostname=toro.cms.waikato.ac.nz
|
---|
15 | # You should change the port to the port of your server (leave it at 3000 if not sure)
|
---|
16 | port=3000
|
---|
17 |
|
---|
18 | # ---------------------------------------------------
|
---|
19 | # NOTHING BELOW THIS POINT SHOULD NEED TO BE MODIFIED
|
---|
20 | # ---------------------------------------------------
|
---|
21 |
|
---|
22 | # get the offseted port values
|
---|
23 | frameserverPort=$port
|
---|
24 | framesaverPort=$((port+1))
|
---|
25 | messagePort=$((port+2))
|
---|
26 | infserverPort=$((port+3))
|
---|
27 | infupdatePort=$((port+4))
|
---|
28 | imageserverPort=$((port+5))
|
---|
29 | imagesaverPort=$((port+6))
|
---|
30 |
|
---|
31 |
|
---|
32 | # setup ssh tunnels
|
---|
33 | ssh -NL $frameserverPort:localhost:$frameserverPort ${username}@${hostname} &
|
---|
34 | ssh -NL $framesaverPort:localhost:$framesaverPort ${username}@${hostname} &
|
---|
35 | ssh -NL $messagePort:localhost:$messagePort ${username}@${hostname} &
|
---|
36 | ssh -NL $infserverPort:localhost:$infserverPort ${username}@${hostname} &
|
---|
37 | ssh -NL $infupdatePort:localhost:$infupdatePort ${username}@${hostname} &
|
---|
38 | ssh -NL $imageserverPort:localhost:$imageserverPort ${username}@${hostname} &
|
---|
39 | ssh -NL $imagesaverPort:localhost:$imagesaverPort ${username}@${hostname} &
|
---|
40 | # give the ssh instances time to connect
|
---|
41 | sleep 1
|
---|
42 | # tunnel udp connections through their equivalent tcp ports
|
---|
43 | java UDPTunnel client $frameserverPort $framesaverPort $messagePort $infserverPort $infupdatePort
|
---|