LDAP:用old HK login
SSH转发:
/root/.nat_rules/opay-new
root@ldap opay-new]# cat maria1-dw-60000
#!/bin/bash
L_PORT="60000"
R_HOST="opay-transaction-slave-dw.c7vkdm90b2v9.eu-west-1.rds.amazonaws.com"
R_PRI_PORT="3306"
MON_PORT="0"
ALIAS="newstage"
VAR=$(expect -c "
spawn /usr/bin/autossh -M $MON_PORT -4 -C -L 0.0.0.0:$L_PORT:$R_HOST:$R_PRI_PORT -N $ALIAS
match_max 100000
expect \"$?assphrase*\"
send -- \"$PASS\r\"
send -- \"\r\"
expect eof
")
echo "======================="
echo "$VAR"
/usr/bin/autossh -M 0 -4 -C -L 0.0.0.0:60000:ip:3306 -N $ALIAS