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:[Service]Type=simpleRestart=alwaysRestartSec=5[Unit] Description=my socat testUser=meGroup=meExecStart=/bin/bash -c '~/my_socat.sh'[Install]WantedBy=multi-user.targetThe script would look like#!/bin/bashsocat PTY,link=/home/me/dev/valve1 TCP:192.168.11.101:5001 & socat PTY,link=/home/me/dev/valve2 TCP:192.168.11.101:5002Would 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 ?
socat: calling from script, bashrc or systemd?
shell script;systemd;serial port;socat