Hello fellas,
My system: FreeBSD-8.0 with nothing special (fresh install of base + kernel) <- vmware test box.
After reading I came up with the following script (pls ignore the grammar mistakes - they were made with intent):
As you can see, the script is very simple and kiddie style
My problem: when I launch the script with [cmd=]/etc/rc.d/connexion_check start[/cmd] it does not go into background, hence causing the boot process to halt when reaching the script. If I run the script outside the rc.d framework, I simply append a "&" sign at the end and the problem goes away.
Here on the other hand, it is a completely different story. I've been poking my eyes out for ~2 days trying to figure it out but with no luck.
Any advice is highly welcomed.
My system: FreeBSD-8.0 with nothing special (fresh install of base + kernel) <- vmware test box.
After reading I came up with the following script (pls ignore the grammar mistakes - they were made with intent):
Code:
#!/bin/sh
#
# PROVIDE: connection_check
# REQUIRE: networking
# BEFORE: LOGIN
# KEYWORD: nojail shutdown
#
#
# Connection_check_enable (bool) Set to "NO" by default.
# Set it to "YES" in "/etc/rc.conf" to enable it on boot.
. /etc/rc.subr
name="connection_check"
start_cmd="${name}_start"
rcvar=`set_rcvar`
pidfile="/var/run/$name.pid"
: ${connection_check_enable="NO"}
load_rc_config $name
connection_check_start()
{
cd /tmp
x=5
while [ $x -gt 1 ]
do
fetch -q http://google.com
if [ -f /tmp/google.com ];then
echo "`date` All is ok. Internet connection is up. Sleeping for 5 min..." >> /var/log/messages
else
echo "`date` We have no internet. Commencing pppoe restart procedure" >> /var/log/messages
/etc/rc.d/ppp stop >> /var/log/messages
wait
ifconfig tun0 destroy >> /var/log/messages
wait
ifconfig tun1 destroy >> /var/log/messages
wait
/etc/rc.d/ppp start >> /var/log/messages
wait
fi
rm -f /tmp/google.com
sleep 300
done
}
run_rc_command "$1"
As you can see, the script is very simple and kiddie style
My problem: when I launch the script with [cmd=]/etc/rc.d/connexion_check start[/cmd] it does not go into background, hence causing the boot process to halt when reaching the script. If I run the script outside the rc.d framework, I simply append a "&" sign at the end and the problem goes away.
Here on the other hand, it is a completely different story. I've been poking my eyes out for ~2 days trying to figure it out but with no luck.
Any advice is highly welcomed.