-
Notifications
You must be signed in to change notification settings - Fork 27
/
raspberryfan.service
35 lines (29 loc) · 1.23 KB
/
raspberryfan.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[Unit]
Description=raspberry pwm fan control
After=network-online.target
Wants=network.target
# notes:
# replace 'podman' for 'docker' if needed.
# create /var/lib/node_exporter directory for node-exporter or remove '-v /var/lib/node_exporter:/var/lib/node_exporter:z' and '--node-exporter' below.
[Service]
Restart=on-failure
RestartSec=10s
ExecStartPre=-/usr/bin/podman rm raspberryfan
ExecStart=/usr/bin/podman run --name=raspberryfan \
-v /var/lib/node_exporter:/var/lib/node_exporter:z \
--device=/dev/gpiochip0 \
--restart unless-stopped \
localhost/gpio \
/usr/bin/python3 /src/fan.py \
--node-exporter \
--min-temp=40 \
--max-temp=70 \
--fan-low=20 \
--fan-high=100 \
--wait-time=10 \
--pwm-gpio=18 \
--pwm-freq=10000
ExecStop=-/usr/bin/podman stop -t 2 raspberryfan
ExecStopPost=/usr/bin/podman rm raspberryfan
[Install]
WantedBy=multi-user.target