
Originally Posted by
BkkBonaza
I would guess that a script in rc.local could loop with a brief delay and just check the interface with something like "ifconfig br0 | grep up" until it validates and then start the services. This seems efficient enough even if not so "nice".
This is almost precisely what I've done. I'll go ahead and post my script(s) for future generations (though I'd still like a "nice" solution, if there is one).
Code:
cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/usr/local/bin/check.sh
exit 0
Code:
cat /usr/local/bin/check.sh
#!/bin/sh
SERVICES="apache2 openvpn dhcp3-server"
for SERVICE in ${********** ; do
STATUS="1"
while [ "${STATUS}" -ne 0 ] ; do
SERVICE_SCRIPT="/etc/init.d/${*********"
${SERVICE_SCRIPT} status > /dev/null 2>&1
STATUS="${?}"
if [ "${STATUS}" -eq 0 ] ; then
echo "The service ${********* is running."
else
echo "The service ${********* is NOT running."
${SERVICE_SCRIPT} start
sleep 5
fi
done
done
Bookmarks