Skip to content

Commit

Permalink
Fix for #30 - Use sleep inifinity instead of sleep <number>
Browse files Browse the repository at this point in the history
Apparently using sleep with very large numbers is not a good idea
when your image can be compiled down to 32-bit platforms.

This fix uses `sleep infinity` and -- failing that -- tries to
sleep for about 68 years (which is exactly 2^15 seconds).
  • Loading branch information
bokysan committed Aug 15, 2020
1 parent 4d12408 commit 35fa2d7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scripts/opendkim.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/sh

noop() {
while true; do
# 2147483647 = max signed 32-bit integer
# 2147483647 s ≅ 70 years
sleep infinity || sleep 2147483647
done
}

if [ ! -d /etc/opendkim/keys ]; then
sleep 9999999999999999999
noop
elif [ -z "$(find /etc/opendkim/keys -type f ! -name .)" ]; then
sleep 9999999999999999999
noop
else
/usr/sbin/opendkim -D -f -x /etc/opendkim/opendkim.conf
fi
Expand Down

0 comments on commit 35fa2d7

Please sign in to comment.