Hello all,
I'm trying to boot tiny core and scp a file to a server as soon as a network connection is established. My scp code is in a script in bootlocal.sh. If I let that scp code execute too early, it kicks back an error about not being connected to the server and quits the scp. Currently, I have hacked in a sleep 5 to ensure that the connection is made, but I'd rather run a script before the scp script that will ensure there is network connectivity before I try the scp and reduce the time it takes to run. So far, I have written this:
#!/bin/sh
#Pinging the server until it responds
unreachable=1;
while [ $unreachable -ne 0 ]; do
echo are you there?
ping -c 1 -w 1 SERVER &> /dev/null
unreachable=$?
echo sleeping
done
echo awake
The problem I am having is that the ping -w 1 doesn't seem to be working. When I unplug the network cable, it runs through the while loop about every 20 seconds instead of every 1 second like I would expect. I would have thought that with a network cable unplugged, ping would immediately throw and error and exit. Am I incorrect in that assumption? Thanks for all the help.
-Aaron