Answer the question
In order to leave comments, you need to log in
How to trace a broken connection using bash?
To get started, I sequentially execute 2 commands in the terminal:
Connect to the VPN $ ssh -D 9999 -N vpn &
And run the script where ports are forwarded to the VPN $ ./proxy.sh
And now the process ./proxy.sh
hangs, and I work in the next tab of the terminal.
But periodically there is a disconnection and the process ./proxy.sh
stops.
Can I somehow track this moment and display, for example, Notification or somehow notify?
Script content ./proxy.sh
:
#!/bin/bash
ssh \
-L 9080:loc0.domain.com:80 \
-L 9081:loc1.domain.com:80 \
-L 9082:loc2.domain.com:80 \
-N vpn
-o "ServerAliveInterval 60"
. Apparently this is what you need?
Answer the question
In order to leave comments, you need to log in
And it’s trite to add output to the screen in proxy.sh
#!/bin/bash
ssh \
-L 9080:loc0.domain.com:80 \
-L 9081:loc1.domain.com:80 \
-L 9082:loc2.domain.com:80 \
-N vpn
echo "************ Proxy has been terminated ********"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question