Skip to content
This repository was archived by the owner on Jan 7, 2024. It is now read-only.

Commit 54587c4

Browse files
committed
Account for people with a single value set
1 parent 476c536 commit 54587c4

File tree

1 file changed

+40
-16
lines changed

1 file changed

+40
-16
lines changed

root/etc/cont-init.d/20-config

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,51 @@ fi
2323

2424
if grep -q "xmx" /config/data/system.properties && grep -q "xms" /config/data/system.properties; then
2525

26-
if [[ -n $MEM_LIMIT ]]; then
27-
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
28-
sed -i "s/unifi.xmx=[0-9]\{1,5\}/unifi.xmx=$MEM_LIMIT/" /config/data/system.properties
29-
fi
26+
if [[ -n $MEM_LIMIT ]]; then
27+
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
28+
sed -i "s/unifi.xmx=[0-9]\{1,5\}/unifi.xmx=$MEM_LIMIT/" /config/data/system.properties
29+
fi
3030

31-
if [[ -n $MEM_STARTUP ]]; then
32-
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
33-
sed -i "s/unifi.xms=[0-9]\{1,5\}/unifi.xms=$MEM_STARTUP/" /config/data/system.properties
34-
fi
31+
if [[ -n $MEM_STARTUP ]]; then
32+
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
33+
sed -i "s/unifi.xms=[0-9]\{1,5\}/unifi.xms=$MEM_STARTUP/" /config/data/system.properties
34+
fi
35+
36+
elif grep -q "xmx" /config/data/system.properties; then
37+
38+
if [[ -n $MEM_LIMIT ]]; then
39+
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
40+
sed -i "s/unifi.xmx=[0-9]\{1,5\}/unifi.xmx=$MEM_LIMIT/" /config/data/system.properties
41+
fi
42+
43+
if [[ -n $MEM_STARTUP ]]; then
44+
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
45+
echo "unifi.xms=$MEM_STARTUP" >> /config/data/system.properties
46+
fi
47+
48+
elif grep -q "xms" /config/data/system.properties; then
49+
50+
if [[ -n $MEM_STARTUP ]]; then
51+
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
52+
sed -i "s/unifi.xms=[0-9]\{1,5\}/unifi.xms=$MEM_STARTUP/" /config/data/system.properties
53+
fi
54+
55+
if [[ -n $MEM_LIMIT ]]; then
56+
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
57+
echo "unifi.xmx=$MEM_LIMIT" >> /config/data/system.properties
58+
fi
3559

3660
else
3761

38-
if [[ -n $MEM_LIMIT ]]; then
39-
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
40-
echo "unifi.xmx=$MEM_LIMIT" >> /config/data/system.properties
41-
fi
62+
if [[ -n $MEM_LIMIT ]]; then
63+
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
64+
echo "unifi.xmx=$MEM_LIMIT" >> /config/data/system.properties
65+
fi
4266

43-
if [[ -n $MEM_STARTUP ]]; then
44-
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
45-
echo "unifi.xms=$MEM_STARTUP" >> /config/data/system.properties
46-
fi
67+
if [[ -n $MEM_STARTUP ]]; then
68+
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
69+
echo "unifi.xms=$MEM_STARTUP" >> /config/data/system.properties
70+
fi
4771

4872
fi
4973

0 commit comments

Comments
 (0)