From 7110f8fa59cc7f18937b9202df125ab7e1bce1bf Mon Sep 17 00:00:00 2001 From: Emanuele Date: Fri, 26 Feb 2021 09:31:53 +0100 Subject: [PATCH] modifiche servizio e messaggi log --- NasoScope/nasomain.py | 4 ++-- NasoScope/nasoscopio.service | 2 +- NasoScope/sshtunnel.service | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 NasoScope/sshtunnel.service diff --git a/NasoScope/nasomain.py b/NasoScope/nasomain.py index 313cf75..032c8c5 100644 --- a/NasoScope/nasomain.py +++ b/NasoScope/nasomain.py @@ -221,7 +221,7 @@ def onMessage(cli, userdata, msg): elif "EXIT" in msg: pass else: - LOGGER.error("Messaggio MQTT sconosciuto") + LOGGER.error(f"Messaggio MQTT sconosciuto: {msg}") pass def onConnect(cli, userdata, flags, rc): @@ -331,7 +331,7 @@ if __name__ == '__main__': # for y in tempSamples[x] for z in tempSamples[x][y]]) firstCap = False firstTS = time.time() - LOGGER.info(f'Inizio cattura TS: {datetime.fromtimestamp(firstTS).strftime("%c")}') + LOGGER.warning(f'Inizio cattura: {datetime.fromtimestamp(firstTS).strftime("%c")}') pass else: for ax in tempSamples: diff --git a/NasoScope/nasoscopio.service b/NasoScope/nasoscopio.service index 8ce030c..35c31fa 100644 --- a/NasoScope/nasoscopio.service +++ b/NasoScope/nasoscopio.service @@ -1,6 +1,6 @@ [Unit] Description=Nasoscopio - Letture Movimento Assi Materia-CL -Requires=network.target mosquitto.service docker.service +Requires=network.target mosquitto.service docker.service sshtunnel.service [Service] RestartSec=15s diff --git a/NasoScope/sshtunnel.service b/NasoScope/sshtunnel.service new file mode 100644 index 0000000..eda4f46 --- /dev/null +++ b/NasoScope/sshtunnel.service @@ -0,0 +1,16 @@ +[Unit] +Description=SSH Tunnel - Letture Movimento Assi Materia-CL +Requires=network.target mosquitto.service docker.service + +[Service] +RestartSec=15s +Type=simple +User=root +Group=root +WorkingDirectory=/root/NasoScopio/NasoScope/ +ExecStart=/usr/bin/autossh -Nf -M 0 -L 8080:192.168.0.1:8080 cnc@192.168.30.51 +PIDFile=/run/sshtunnel.pid +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file