I am trying to write a bash script in a file that would, when run start pinging a host until it becomes available, when the host becomes reachable it runs a command and stops executing, i tried writing one but the script continues pinging until the count ends,
Plus i need to put that process in the background but if i run the script with the $ sign it still runs in foreground,
#!/bin/bash ping -c30 -i3 192.168.137.163 if [ $? -eq 0 ] then /root/scripts/test1.sh exit 0 else echo “fail” fi
Any help would be appreciated tnx in advance!