From 5dd69666ff38f07313a43137953da4522a8d674f Mon Sep 17 00:00:00 2001 From: iamromulan <50184035+iamromulan@users.noreply.github.com> Date: Fri, 1 Dec 2023 22:18:38 -0500 Subject: [PATCH] Reorganized add separate systemd units for use with smd7 as well --- .../at-telnet-daemon.service | 25 +++++++++++++++++++ .../socat-smd7-from-ttyIN.service | 14 +++++++++++ .../socat-smd7-to-ttyIN.service | 14 +++++++++++ .../socat-smd7.service | 0 4 files changed, 53 insertions(+) create mode 100644 attelnetdaemon/at-telnet/smd7_systemd_units/at-telnet-daemon.service create mode 100644 attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7-from-ttyIN.service create mode 100644 attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7-to-ttyIN.service rename attelnetdaemon/at-telnet/{systemd_units => smd7_systemd_units}/socat-smd7.service (100%) diff --git a/attelnetdaemon/at-telnet/smd7_systemd_units/at-telnet-daemon.service b/attelnetdaemon/at-telnet/smd7_systemd_units/at-telnet-daemon.service new file mode 100644 index 0000000..5765326 --- /dev/null +++ b/attelnetdaemon/at-telnet/smd7_systemd_units/at-telnet-daemon.service @@ -0,0 +1,25 @@ +[Unit] +Description=Telnet daemon for AT command + +# Being extra silly with the dependencies for this. +# TODO: Update the python code to validate that the serial port +# is working on a regular basis, and keep attempting to retry +# if not. Then these dependencies won't need to be so strict. +After=socat-smd11.service +Requires=socat-smd11.service socat-smd11-from-ttyIN.service socat-smd11-to-ttyIN.service +ReloadPropagatedFrom=socat-smd11.service socat-smd11-from-ttyIN.service socat-smd11-to-ttyIN.service + +StartLimitIntervalSec=2m +StartLimitBurst=100 + +[Service] +ExecStart=/usrdata/at-telnet/modem-multiclient.py +Nice=5 +Restart=always +RestartSec=2s +# Increased log rate limits, so we can see what's going on. +LogRateLimitIntervalSec=5s +LogRateLimitBurst=100 + +[Install] +WantedBy=multi-user.target diff --git a/attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7-from-ttyIN.service b/attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7-from-ttyIN.service new file mode 100644 index 0000000..6ba283e --- /dev/null +++ b/attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7-from-ttyIN.service @@ -0,0 +1,14 @@ +[Unit] +Description=Read from /dev/ttyIN and write to smd11 +BindsTo=socat-smd11.service +After=socat-smd11.service + +[Service] +ExecStart=/bin/bash -c "/bin/cat /dev/ttyIN > /dev/smd11" +ExecStartPost=/bin/sleep 2s +StandardInput=tty-force +Restart=always +RestartSec=1s + +[Install] +WantedBy=multi-user.target diff --git a/attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7-to-ttyIN.service b/attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7-to-ttyIN.service new file mode 100644 index 0000000..f72da6b --- /dev/null +++ b/attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7-to-ttyIN.service @@ -0,0 +1,14 @@ +[Unit] +Description=Read from /dev/smd11 and write to ttyIN +BindsTo=socat-smd11.service +After=socat-smd11.service + +[Service] +ExecStart=/bin/bash -c "/bin/cat /dev/smd11 > /dev/ttyIN" +ExecStartPost=/bin/sleep 2s +StandardInput=tty-force +Restart=always +RestartSec=1s + +[Install] +WantedBy=multi-user.target diff --git a/attelnetdaemon/at-telnet/systemd_units/socat-smd7.service b/attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7.service similarity index 100% rename from attelnetdaemon/at-telnet/systemd_units/socat-smd7.service rename to attelnetdaemon/at-telnet/smd7_systemd_units/socat-smd7.service