Skip to content

Commit

Permalink
remove shared memory files before starting the FTL process. Mimics ba…
Browse files Browse the repository at this point in the history
…re metal service script (to an extent)

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
  • Loading branch information
PromoFaux committed Feb 16, 2021
1 parent 3f0a7d8 commit 7300a9a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions s6/debian-root/etc/cont-init.d/20-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

bashCmd='bash -e'
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
set -x ;
bashCmd='bash -e -x'
fi
Expand All @@ -11,8 +11,8 @@ fi

$bashCmd /start.sh
# Gotta go fast, no time for gravity
if [ -n "$PYTEST" ]; then
sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)"
if [ -n "$PYTEST" ]; then
sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)"
fi
if [ -z "$SKIPGRAVITYONBOOT" ]; then
gravity.sh
Expand All @@ -21,6 +21,6 @@ else
fi

# Kill dnsmasq because s6 won't like it if it's running when s6 services start
kill -9 $(pgrep pihole-FTL) || true
kill -9 $(pgrep pihole-FTL) || true # TODO: REVISIT THIS SO AS TO NOT kill -9

pihole -v
2 changes: 1 addition & 1 deletion s6/debian-root/etc/services.d/pihole-FTL/finish
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bash

s6-echo "Stopping pihole-FTL"
kill -9 $(pgrep pihole-FTL)
kill -9 $(pgrep pihole-FTL) # TODO: REVISIT THIS SO AS TO NOT kill -9
3 changes: 3 additions & 0 deletions s6/debian-root/etc/services.d/pihole-FTL/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/with-contenv bash

s6-echo "Starting pihole-FTL ($FTL_CMD) as ${DNSMASQ_USER}"
# Remove possible leftovers from previous pihole-FTL processes
rm -f /dev/shm/FTL-* 2> /dev/null
rm /run/pihole/FTL.sock 2> /dev/null
s6-setuidgid ${DNSMASQ_USER} pihole-FTL $FTL_CMD >/dev/null 2>&1

# Notes on above:
Expand Down

0 comments on commit 7300a9a

Please sign in to comment.