Use s6-notifyoncheck to check for services startup readiness
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user