I'd like to have a UNIX domain socket, say /var/program/program.cmd for example, exposed via TCP, lets say on port 12345. I'd also like this to be running full time in the background.
What's the best way to do this? If its relevant the system is running Ubuntu 12.04.2.
Also with the proposed solution will it survive the domain socket being removed and recreated?
EDIT
Here is the outcome of the accepted answer in the form of an init script: https://github.com/Wirehive/haproxy-remote
You can use
socat
to export your unix socket as TCP socket. Here is the command to do so:This will create TCP socket listening on port 12345 which will connect to mentioned unix socket of your program.
For the deletion issue, I did not test it myself. You can verify it and tell us about it :)
Note: You may not find socat installed, you just need to type:
apt-get install socat
to install it.