socat only once.
I'm trying to expose
docker web services via TCP. On macOS/linux these services are bound to a unix socket. The following command accomplishes the task:
socat -d TCP-LISTEN:2376,range=127.0.0.1/32,reuseaddr,fork UNIX:/var/run/docker.sock
So I don't have to remember to type this all the time, I'd like it to start when the computer starts. I don't know how to accomplish that particular goal, but I have done a little bit of work with
.bash_profile. So I'll settle for running
socat whenever a
terminal runs. However, since
.bash_profile runs for every
terminal instance, I'd like a mechanism that only runs the command if it's not already running. But I don't know how to check, from
.bash_profile if something is already running. Can you help?