/ Published in: Bash

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
PRODUCTION_PORT=33006 PRODUCTION_SERVER_AUTH=root@0.0.0.0.0 #connect to the tunnel and put the connection to the background ssh -f -N -L $PRODUCTION_PORT:localhost:3306 $PRODUCTION_SERVER_AUTH ... (do some mysql work by connecting to localhost) ... #Find the PID of the ssh tunnel in the background and assign it to a variable PID=$(ps -eo pid,args | grep 'ssh -f -N -L 33006:localhost' | grep -v 'grep' | cut -c1-6) #kill the tunnel kill -9 $PID
Comments
