diff --git a/NasoScope/Nasoscope.log b/NasoScope/Nasoscope.log deleted file mode 100644 index e69de29..0000000 diff --git a/NasoScope/__init__.py b/NasoScope/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/NasoScope/sshtunnel.service b/NasoScope/sshtunnel.service deleted file mode 100644 index eda4f46..0000000 --- a/NasoScope/sshtunnel.service +++ /dev/null @@ -1,16 +0,0 @@ -[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 diff --git a/NasoScope/config.json b/config-grande.json similarity index 81% rename from NasoScope/config.json rename to config-grande.json index a5ae21b..daeea56 100644 --- a/NasoScope/config.json +++ b/config-grande.json @@ -1,14 +1,14 @@ { - "version": "0.2", - "logFile": "/var/log/nasoscopio.log", + "version": "0.3", + "logFile": "/var/log/nasoscopio-grande.log", "logFormat": "%(asctime)s|%(levelname)-7s|%(funcName)-10s|%(lineno)-3d: %(message)-50s", "logTimeFormat": "%m-%d %H:%M:%S", - "URL": "http://localhost:8080", + "URL": "http://localhost:8880", "samplePeriod": 10, "loopPeriod": 0.5, "recordTime": 3600, "fileSaveTime": 360, - "fileSaveDir": "/tmp/{}_CL3015HSD.{fType}", + "fileSaveDir": "/tmp/GRANDE_{}_CL3015HSD.{fType}", "fileType": "csv", "variables": [ {"deviceID":1, "name": "AsseX", @@ -51,13 +51,13 @@ }, "mqttHost": "localhost", "mqttPort": 1883, - "mqttSend": "nasoscope/cnc2recorder", - "mqttReceive": "nasoscope/recorder2cnc", - "sendMqtt": true, - "mqttSendSamples": "nasoscope/samples", + "mqttSend": "nasoscope/grande/cnc2recorder", + "mqttReceive": "nasoscope/grande/recorder2cnc", + "sendMqtt": false, + "mqttSendSamples": "nasoscope/grande/samples", "sendInflux": true, "influxHost": "localhost", "influxPort": 8086, - "influxDB": "axes", + "influxDB": "axes_grande", "influxRetention": "one_day" } \ No newline at end of file diff --git a/config-piccola.json b/config-piccola.json new file mode 100644 index 0000000..a5a9353 --- /dev/null +++ b/config-piccola.json @@ -0,0 +1,63 @@ +{ + "version": "0.3", + "logFile": "/var/log/nasoscopio-piccola.log", + "logFormat": "%(asctime)s|%(levelname)-7s|%(funcName)-10s|%(lineno)-3d: %(message)-50s", + "logTimeFormat": "%m-%d %H:%M:%S", + "URL": "http://localhost:8881", + "samplePeriod": 10, + "loopPeriod": 0.5, + "recordTime": 3600, + "fileSaveTime": 360, + "fileSaveDir": "/tmp/PICCOLA_{}_CL3015HSD.{fType}", + "fileType": "csv", + "variables": [ {"deviceID":1, + "name": "AsseX", + "codes": [1000,1002,1017,1021,1022,1038], + "descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"] + }, + {"deviceID":2, + "name": "AsseY", + "codes": [1000,1002,1017,1021,1022,1038], + "descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"] + }, + {"deviceID":3, + "name": "AsseZ", + "codes": [1000,1002,1017,1021,1022,1038], + "descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"] + }, + {"deviceID":4, + "name": "AsseC", + "codes": [1000,1002,1017,1021,1022,1038], + "descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"] + }, + {"deviceID":5, + "name": "AsseB", + "codes": [1000,1002,1017,1021,1022,1038], + "descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"] + }, + {"deviceID":6, + "name": "AsseXs", + "codes": [1000,1002,1017,1021,1022,1038], + "descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"] + } + ], + "variableNames": { + "1000": "ActualFeed", + "1002": "FollowingError", + "1017": "MeasuredPosition", + "1021": "CalculatedAcceleration", + "1022": "Jerk", + "1038": "ServoPoint" + }, + "mqttHost": "localhost", + "mqttPort": 1883, + "mqttSend": "nasoscope/piccola/cnc2recorder", + "mqttReceive": "nasoscope/piccola/recorder2cnc", + "sendMqtt": false, + "mqttSendSamples": "nasoscope/piccola/samples", + "sendInflux": true, + "influxHost": "localhost", + "influxPort": 8086, + "influxDB": "axes_piccola", + "influxRetention": "one_day" +} \ No newline at end of file diff --git a/NasoScope/nasomain.py b/nasomain.py similarity index 97% rename from NasoScope/nasomain.py rename to nasomain.py index 032c8c5..e7cca16 100644 --- a/NasoScope/nasomain.py +++ b/nasomain.py @@ -246,9 +246,10 @@ if __name__ == '__main__': loopcount = 0 variableMap = list() samples = dict() - + try: - fp = open("config.json") + print(f'Config: {sys.argv[1]}') + fp = open(str(sys.argv[1])) settings = json.load(fp) fp.close() except: diff --git a/NasoScope/nasoscopio.service b/nasoscopio-grande.service similarity index 51% rename from NasoScope/nasoscopio.service rename to nasoscopio-grande.service index 35c31fa..fb8a3e6 100644 --- a/NasoScope/nasoscopio.service +++ b/nasoscopio-grande.service @@ -1,15 +1,15 @@ [Unit] -Description=Nasoscopio - Letture Movimento Assi Materia-CL -Requires=network.target mosquitto.service docker.service sshtunnel.service +Description=Nasoscopio - Letture Movimento Assi Materia-CL4020 +Requires=network.target mosquitto.service docker.service sshtunnel-grande.service [Service] RestartSec=15s Type=simple -User=root -Group=root +User=briq +Group=briq WorkingDirectory=/root/NasoScopio/NasoScope/ -ExecStart=/usr/bin/python3 nasomain.py -PIDFile=/run/Nasoscopio.pid +ExecStart=/usr/bin/python3 nasomain.py config-grande.json +PIDFile=/run/nasoscopio-grande.pid Restart=always [Install] diff --git a/nasoscopio-piccola.service b/nasoscopio-piccola.service new file mode 100644 index 0000000..4c35abb --- /dev/null +++ b/nasoscopio-piccola.service @@ -0,0 +1,16 @@ +[Unit] +Description=Nasoscopio - Letture Movimento Assi Materia-CL3015 +Requires=network.target mosquitto.service docker.service sshtunnel-piccola.service + +[Service] +RestartSec=15s +Type=simple +User=briq +Group=briq +WorkingDirectory=/home/briq/Nasoscopio/ +ExecStart=/usr/bin/python3 nasomain.py config-piccola.json +PIDFile=/run/nasoscopio-piccola.pid +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/sshtunnel-grande.service b/sshtunnel-grande.service new file mode 100644 index 0000000..2b80c4e --- /dev/null +++ b/sshtunnel-grande.service @@ -0,0 +1,16 @@ +[Unit] +Description=SSH Tunnel - Letture Movimento Assi Materia-CL4020 +Requires=network.target mosquitto.service docker.service + +[Service] +RestartSec=15s +Type=simple +User=briq +Group=briq +WorkingDirectory=/home/briq/NasoScopio/ +ExecStart=/usr/bin/autossh -Nf -M 0 -L 8880:192.168.0.1:8080 cnc@192.168.30.50 +PIDFile=/run/sshtunnel-grande.pid +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/sshtunnel-piccola.service b/sshtunnel-piccola.service new file mode 100644 index 0000000..6fc3bd9 --- /dev/null +++ b/sshtunnel-piccola.service @@ -0,0 +1,16 @@ +[Unit] +Description=SSH Tunnel - Letture Movimento Assi Materia-CL3015 +Requires=network.target mosquitto.service docker.service + +[Service] +RestartSec=15s +Type=simple +User=briq +Group=briq +WorkingDirectory=/home/briq/NasoScopio/ +ExecStart=/usr/bin/autossh -Nf -M 0 -L 8881:192.168.0.1:8080 cnc@192.168.30.51 +PIDFile=/run/sshtunnel-piccola.pid +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/NasoScope/templates.py b/templates.py similarity index 100% rename from NasoScope/templates.py rename to templates.py