Created
May 9, 2017 02:14
-
-
Save hdoverobinson/bd9ab39d3af22c6b5763f3ab356848bb to your computer and use it in GitHub Desktop.
Socat server and client for use with NTP's type 18 ACTS driver.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This is currently used by an NTP server to access a V.92 modem over the LAN to dial the NIST ACTS. | |
#The options here work using a USR5686G modem over a PL2303 USB to RS232 adapter with NTP 4.2.8p8. | |
#NTP expects a device called "acts1" at 19200 baud. You should adjust the port number, character device file, baudrate, and lockfile to suit your environment. | |
#NTP will not autobaud after a successful connection using this method. The modem init string in ntpd/refclock_acts.c must be edited to lock the modem to 19200 baud. | |
#A ping test was added to the client to limit the number of retries it makes during a network outage. | |
#These are placed in startup scripts run by a cronjob. | |
#socat-server | |
/usr/bin/screen -dmS socat-server-acts1 /bin/bash -c "while true; do /usr/bin/socat -v -d -d -d -t10 tcp-l:54321,reuseaddr,keepalive file:/dev/ttyUSB0,b19200,nonblock,raw,echo=0,cread,cs8,crtscts,min=1,time=0,nl0,cr0,tab0,bs0,vt0,ff0,waitlock=/var/run/ttyUSB0.lock; done" | |
#socat-client | |
/usr/bin/screen -dmS socat-client-acts1 /bin/bash -c "while true; do /bin/ping -c5 socat-server-acts1.local && /usr/bin/socat -v -d -d -d pty,link=/dev/acts1,raw,echo=0,waitslave,user=root,group=dialout,mode=660 tcp:socat-server-acts1.local:54321,keepalive,ignoreeof; echo 'Restarting...'; sleep 5s; done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment