I have an /etc/init.d/ script that starts on boot and requires networking to be in place. I have the rc start set to 99, so it's the last thing that loads, but the networking doesn't load immediately and I'm currently having to rely on a 30 second sleep command to wait for network loading.
The OS is Ubuntu modified for embedded systems (Yocto Project). The filesystem is the same, but there are very limited services so it's using Sysvinit.
Is there a way to check that all networking has finished loading?
Here is the script if it is of help:
#!/bin/sh
#
# Daemon Name: blerd
#
# chkconfig: - 3 99 1
# description: M3 Bluetooth Low Energy Relay Daemon
# Source function library.
. /etc/init.d/functions
PROGRAM=bler
LOCKFILE=/var/lock/subsys/$PROGRAM
start() {
[ -x $EXE ] || exit 5
echo -n "Starting $PROGRAM: ";
if [ -e $LOCKFILE ]; then
echo "Instance of $PROGRAM exists."
return 0;
fi
sleep 30
$PROGRAM
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Success"
else
echo "Failed"
fi
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
stop() {
echo -n "Stopping $PROGRAM: "
if [ ! -e $LOCKFILE ]; then
echo "No instance of $PROGRAM exists."
return 0;
fi
killproc $PROGRAM
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Success"
else
echo "Failed"
fi
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
return $RETVAL
}
status() {
echo -n "Status $PROGRAM: "
if [ -e $LOCKFILE ]; then
echo "Running"
else
echo "Stopped"
fi
return 0;
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 2
;;
esac
ubuntu
but looks like a SysVinit script for RHEL. – Xiphoid