|
1 #!/bin/bash |
|
2 # |
|
3 # thermferm init script for Slackware. |
|
4 # |
|
5 # Copyright 2022-2024 Michiel Broek, the Netherlands. |
|
6 |
|
7 # Source default settings: |
|
8 if [ -r /etc/default/thermferm ]; then |
|
9 . /etc/default/thermferm |
|
10 fi |
|
11 |
|
12 PIDFILE=/run/thermferm.pid |
|
13 |
|
14 case "$1" in |
|
15 start) |
|
16 echo -n "Starting Fermentation Controller: " |
|
17 if [ -f ${PIDFILE} ]; then |
|
18 echo "already running." |
|
19 else |
|
20 ${THERMFERM_BIN} |
|
21 echo "done." |
|
22 fi |
|
23 ;; |
|
24 |
|
25 stop) |
|
26 echo -n "Stopping Fermentation Controller: " |
|
27 if [ -f ${PIDFILE} ]; then |
|
28 kill $(cat ${PIDFILE}) |
|
29 echo "done." |
|
30 else |
|
31 echo "wasn't running." |
|
32 fi |
|
33 ;; |
|
34 |
|
35 restart) |
|
36 $0 stop |
|
37 sleep 2 |
|
38 $0 start |
|
39 ;; |
|
40 |
|
41 *) |
|
42 echo "usage: $0 {start|stop|restart}" |
|
43 esac |
|
44 |