Browse Source

[issue #25] ajout de commentaire dans le script de pre-exec, ajout de ExecStartPre dans le fichier service

Maxime Alves LIRMM@home 3 years ago
parent
commit
b202f44172
2 changed files with 9 additions and 4 deletions
  1. 8
    4
      config/pre-exec.sh
  2. 1
    0
      config/pyheatpump_supervise.service

+ 8
- 4
config/pre-exec.sh View File

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

+ 1
- 0
config/pyheatpump_supervise.service View File

6
 Type=simple
6
 Type=simple
7
 WorkingDirectory=/var/lib/pyheatpump/
7
 WorkingDirectory=/var/lib/pyheatpump/
8
 Environment="LOGLEVEL=INFO"
8
 Environment="LOGLEVEL=INFO"
9
+ExecStartPre=/opt/pyHeatpump/config/pre-exec.sh
9
 ExecStart=/usr/bin/env pyheatpump supervise --since
10
 ExecStart=/usr/bin/env pyheatpump supervise --since
10
 KillMode=mixed
11
 KillMode=mixed
11
 TimeoutStopSec=30sec
12
 TimeoutStopSec=30sec

Loading…
Cancel
Save