tools/init.slackware

Tue, 31 Aug 2021 20:48:37 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 31 Aug 2021 20:48:37 +0200
changeset 774
92e1e8f175a2
parent 746
44d929ff268e
permissions
-rw-r--r--

Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.

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

mercurial