Merge pull request #1665 from yubiuser/s6-notifyoncheck

Use s6-notifyoncheck to check for services startup readiness.

(Thanks for this. Let's see how it works out!)
This commit is contained in:
Mike Brady
2023-04-22 17:37:12 +01:00
committed by GitHub
12 changed files with 32 additions and 14 deletions
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
exec dbus-send --system / org.freedesktop.DBus.Peer.Ping > /dev/null 2> /dev/null
@@ -0,0 +1 @@
3
@@ -1,4 +1,3 @@
#!/command/with-contenv sh
rm -rf /var/run/dbus/dbus.pid
echo "Starting dbus"
exec dbus-daemon --system --nofork
exec s6-notifyoncheck dbus-daemon --system --nofork --nopidfile
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
state="$(dbus-send --system --dest=org.freedesktop.Avahi --print-reply / org.freedesktop.Avahi.Server.GetState | grep int32 | awk '{printf $2}')"
# Avahi will return 'state=2' when 'Server startup complete'
if [ "$state" = 2 ]; then
exit 0
else
exit 1
fi
@@ -0,0 +1 @@
3
@@ -1,7 +1,3 @@
#!/command/with-contenv sh
while [ ! -f /var/run/dbus/dbus.pid ]; do
echo "s6-rc: warning: dbus is not running, sleeping for 1 second before trying to start avahi"
sleep 1
done
echo "Starting avahi"
exec avahi-daemon --no-chroot
exec s6-notifyoncheck avahi-daemon --no-chroot
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
exec dbus-send --system / org.freedesktop.DBus.Peer.Ping > /dev/null 2> /dev/null
@@ -0,0 +1 @@
3
+1 -2
View File
@@ -1,4 +1,3 @@
#!/command/with-contenv sh
rm -rf /var/run/dbus/dbus.pid
echo "Starting dbus"
exec dbus-daemon --system --nofork
exec s6-notifyoncheck dbus-daemon --system --nofork --nopidfile
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
state="$(dbus-send --system --dest=org.freedesktop.Avahi --print-reply / org.freedesktop.Avahi.Server.GetState | grep int32 | awk '{printf $2}')"
# Avahi will return 'state=2' when 'Server startup complete'
if [ "$state" = 2 ]; then
exit 0
else
exit 1
fi
@@ -0,0 +1 @@
3
+1 -5
View File
@@ -1,7 +1,3 @@
#!/command/with-contenv sh
while [ ! -f /var/run/dbus/dbus.pid ]; do
echo "s6-rc: warning: dbus is not running, sleeping for 1 second before trying to start avahi"
sleep 1
done
echo "Starting avahi"
exec avahi-daemon --no-chroot
exec s6-notifyoncheck avahi-daemon --no-chroot