I do want to use socat for directing serial commands over ethernet to a ethernet-serial converter (static ip adress). I was wondering which would a good way of starting socat.

If I understand everything correctly systemd would allow me to make sure socat is alway running or in case of failure, tries to restart. The .service file would look like:


Description=my socat test

ExecStart=/bin/bash -c '~/my_socat.sh'


The script would look like

socat PTY,link=/home/me/dev/valve1 TCP: & socat PTY,link=/home/me/dev/valve2 TCP:

Would this approach do what I want ? Would socat be restarted if it dies for some reason ? And what would happen if the ethernet connection is not available when socat is started ? Running it from the shell without network connection does not work and the command fails with the error message "network is unreachable".

How would you make sure socat is running before my (python) script is executed ? Would you start socat from within python ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.