This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NetVM=$1 | |
TargetVM=$2 | |
Service=$3 | |
TCP_Port=$4 | |
wasrunning=$(qvm-ls | grep $TargetVM | grep -i RUNNING) | |
echo -ne "TCP socket connection for $Service from $NetVM to $TargetVM on port $TCP_Port...\nPress Any Key to End\n\n" | |
trap cleanup 1 2 3 6 15 | |
cleanup() { | |
# qvm-run -p -u root $NetVM "iptables-save | grep -v 'SOCAT_PortFwd-$Service' | iptables-restore" |