Guest User

Untitled

a guest
Oct 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. HOST = # masked
  2. SOURCE_PORT = 5672
  3. DESTINATION_PORT = 5672
  4. USERNAME = ifesdjeen
  5.  
  6. createTunnel() {
  7. /usr/bin/ssh -f -N -L$SOURCE_PORT:$HOST:$DESTINATION_PORT -L19922:HOST:22 ifesdjeen@$HOST
  8. if [[ $? -eq 0 ]]; then
  9. echo Tunnel to $HOST created successfully
  10. else
  11. echo An error occurred creating a tunnel to $HOST RC was $?
  12. fi
  13. }
  14.  
  15. /usr/bin/ssh -p 19922 $USERNAME@localhost ls
  16. if [[ $? -ne 0 ]]; then
  17. echo Creating new tunnel connection
  18. createTunnel
Add Comment
Please, Sign In to add comment