I am trying to invoke a command (mysql CLI) when I connect to a certain port.
This works just fine, except that every time I connect, a new instance of the command is invoked.
Tried to use the end-close option but mysql CLI is killed when I close the connection, and a new one is fired when I reconnect. Command line used is below. Any way to have socat launching the mysql command once, and just reuse that process when new connections arrive? Thanks in advance!
socat TCP4-LISTEN:$port,reuseaddr,fork,bind=127.0.0.1,linger=3600 EXEC:"mysql -ANnvvf -u $user -h $host $passstr $portstr $socketstr",end-close
question from:
https://stackoverflow.com/questions/65943376/can-socat-exec-a-program-just-once-when-accepting-a-connection 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…