Skip to content

Commit bf3c2a0

Browse files
committed
Tweaked service installer
1 parent a40f439 commit bf3c2a0

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

examples/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@ You can then stop the fan service with:
3737

3838
```
3939
sudo systemctl stop pimoroni-fanshim.service
40-
```
40+
```
41+
42+
If you need to change the threshold, hysteresis or delay you can add them as arguments to the installer:
43+
44+
```
45+
sudo ./install-service <threshold> <hysteresis> <delay>
46+
```

examples/automatic.py

100644100755
File mode changed.

examples/install-service.sh

100644100755
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
2+
THRESHOLD=${1:-36}
3+
HYSTERESIS=${2:-2}
4+
DELAY=${3:-2}
25
SERVICE_PATH=/etc/systemd/system/pimoroni-fanshim.service
36

47
read -r -d '' UNIT_FILE << EOF
@@ -9,7 +12,7 @@ After=multi-user.target
912
[Service]
1013
Type=simple
1114
WorkingDirectory=$(pwd)
12-
ExecStart=$(pwd)/automatic.py --threshold 36
15+
ExecStart=$(pwd)/automatic.py --threshold $THRESHOLD --hysteresis $HYSTERESIS --delay $DELAY
1316
Restart=on-failure
1417
1518
[Install]
@@ -24,4 +27,4 @@ echo "$UNIT_FILE" > $SERVICE_PATH
2427
systemctl daemon-reload
2528
systemctl enable pimoroni-fanshim.service
2629
systemctl start pimoroni-fanshim.service
27-
systemctl status pimoroni-fanshim.service
30+
systemctl status pimoroni-fanshim.service

0 commit comments

Comments
 (0)