Pietro Sammarco wrote:

[...]

Essentially what I need to do is to add a 30 seconds scheduling time to
this script, so that each and every 30 seconds it will check if
google.comis pingable, and if not it will do what the script it
supposed to do, and
at the same time I want to keep the start and stop feature.

You can use endless loop with sleep 30 in it.

while [ 1 ];
do
    if ! [ `ping -q -c 4 -o google.com > /dev/null` ]; then
        ifconfig wlan0 down & ifconfig wlan0 up & dhclient wlan0
    fi
    sleep 30
done

It is better to send more than one packet in case of some packet loss on the line (-c 4)

The problem with your rc script is, that it will be running forever and will not return.

I think you need one script running like a "daemon" and another one (rc) to control the first one. (starting / stopping)

You can learn more about rc scripting in this article
http://www.freebsd.org/doc/en/articles/rc-scripting/article.html

Miroslav Lachman
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-rc
To unsubscribe, send any mail to "[email protected]"

Reply via email to