Fri, 17 Jun 2022 16:18:04 +0200
Version 0.3.39. Log ispindel, fermenters and co2pressure in MySQL. Limit logging to at most once per 10 minutes.
744
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | #!/bin/bash |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | # |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | # bmsd init script for Slackware. |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | # |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | # Copyright 2021 Michiel Broek, the Netherlands. |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | case "$1" in |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | start) |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | echo -n "Starting Brewery Management System: " |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | if [ -f /var/lib/bms/.bms/bms.config ]; then |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | if [ -f /var/lib/bms/.bms/run/bmsd.pid ]; then |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | echo "already running." |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | else |
746
44d929ff268e
Can start the daemon as root, and it will drop privileges.
Michiel Broek <mbroek@mbse.eu>
parents:
744
diff
changeset
|
15 | /var/lib/bms/bin/bmsd |
744
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | sleep 1 |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | echo "done." |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | fi |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | else |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | echo "not configured." |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | fi |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | ;; |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | stop) |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | echo -n "Stopping Brewery Management System: " |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | if [ -f /var/lib/bms/.bms/run/bmsd.pid ]; then |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | kill $(cat /var/lib/bms/.bms/run/bmsd.pid) |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | sleep 3 |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | rm -f /var/lib/bms/.bms/run/bmsd.pid |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | echo "done." |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | else |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | echo "wasn't running." |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | fi |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | ;; |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | restart) |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | $0 stop |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | sleep 1 |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | $0 start |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | ;; |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | *) |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | echo "usage: $0 {start|stop|restart}" |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | esac |
b8ccc85675a0
Added installation for Slackware and separated the systemd.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 |