浏览代码

[issue #25] fix service (RuntimeDirectory créé le repertoire temporaire dorénavant

Maxime Alves LIRMM@home 3 年前
父节点
当前提交
8a9de838e9
共有 2 个文件被更改,包括 10 次插入5 次删除
  1. 7
    3
      config/pre-exec.sh
  2. 3
    2
      config/pyheatpump_supervise.service

+ 7
- 3
config/pre-exec.sh 查看文件

@@ -1,10 +1,12 @@
1 1
 #!/bin/sh
2 2
 
3 3
 # If directory exists don't run the script
4
-[ ! -d /run/pyheatpump ] && mkdir /run/pyheatpump || exit 0;
5
-
6 4
 # cd /opt/pyheatpump git clone https://git.yannweb.net/cli/pyHeatpump.git
7
-[ ! -d /opt/pyHeatpump/ ] && echo "Missing /opt/pyheatpump/" && exit 1;
5
+[ ! -d /opt/pyHeatpump/ ] && echo "Missing /opt/pyHeatpump/" && exit 1;
6
+[ ! -d /run/pyheatpump/ ] && echo "Missing /run/pyheatpump/" && exit 1;
7
+
8
+[ -f /run/pyheatpump/pyheatpump.sqlite3 ] && [ -f /run/pyheatpump/pyheatpump.ini ] \
9
+        && echo "Incorrect runtime directory" && exit 1;
8 10
 
9 11
 # Database initialization
10 12
 sqlite3 -init /opt/pyHeatpump/db/pyheatpump.sql /run/pyheatpump/pyheatpump.sqlite3 .quit \
@@ -13,3 +15,5 @@ sqlite3 -init /opt/pyHeatpump/db/pyheatpump.sql /run/pyheatpump/pyheatpump.sqlit
13 15
 # Default configuration setup
14 16
 cp /opt/pyHeatpump/config/pyheatpump.prod.ini.dist /run/pyheatpump/pyheatpump.ini \
15 17
     || (echo "Failed to initialized configuration file" && exit 1);
18
+
19
+exit 0;

+ 3
- 2
config/pyheatpump_supervise.service 查看文件

@@ -1,10 +1,11 @@
1 1
 [Unit]
2
-Description=pyHeatpump fetch - retrieve the data from the serial port with modbus
2
+Description=pyheatpump supervise - fetch by modbus and send data to supervisor
3 3
 Wants=dev-rs485.device
4 4
 
5 5
 [Service]
6 6
 Type=simple
7
-WorkingDirectory=/var/run/pyheatpump/
7
+RuntimeDirectory=pyheatpump
8
+WorkingDirectory=/run/pyheatpump
8 9
 Environment="LOGLEVEL=INFO"
9 10
 ExecStartPre=/opt/pyHeatpump/config/pre-exec.sh
10 11
 ExecStart=/usr/bin/env pyheatpump supervise --since

正在加载...
取消
保存