From 993abb03633c85e273698e8b225bc07952497767 Mon Sep 17 00:00:00 2001 From: Sangbum Kim Date: Tue, 21 Nov 2017 00:23:14 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EC=83=81=ED=95=9C=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- air_monitor | 2 ++ air_monitor.service | 4 +++- main.py | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100755 air_monitor 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')