diff --git a/air_monitor b/air_monitor new file mode 100755 index 0000000..dacc730 --- /dev/null +++ b/air_monitor @@ -0,0 +1,2 @@ +#!/bin/bash +exec python main.py \ No newline at end of file diff --git a/air_monitor.service b/air_monitor.service index 19aafe6..17554e8 100644 --- a/air_monitor.service +++ b/air_monitor.service @@ -4,7 +4,9 @@ After=syslog.target [Service] WorkingDirectory=/opt/air_monitor -ExecStart=/opt/air_monitor/venv/bin/python main.py +Environment=VIRTUAL_ENV=/opt/air_monitor/venv/ +Environment=PATH=$VIRTUAL_ENV/bin:$PATH +ExecStart=/opt/air_monitor/air_monitor TimeoutStartSec=5 User=nobody Group=nobody diff --git a/main.py b/main.py index 9b8f2d5..f227add 100644 --- a/main.py +++ b/main.py @@ -45,7 +45,6 @@ if __name__ == '__main__': daemon.notify('READY=1') for at, info in getStat(dev): message = Message('air', int(at*1000000000), tags, info._asdict()) - print(json.dumps([message._asdict()])) metric.write_points([message._asdict()]) finally: daemon.notify('STOPPING=1')