понедельник, 19 декабря 2016 г.

Automatically respawning socat.

When user disconnects from socat the process terminates, so you have to restart it.
To automate this process, you can use /etc/inittab.


s1:2345:respawn:/usr/bin/socat tcp-l:12001,reuseaddr,forever /dev/ttyS2,b9600,cs8,cstopb=0,raw,unlink-close=0,echo=0
view raw inittab hosted with ❤ by GitHub
Here
2345 -- is enumeration of runlevels for which process is started,
s1 -- is a unique sequence of 1-4 characters which identifies an entry in inittab.

This socat configuration is used to provide access to serial port (UART / RS-485) over TCP/IP.