Waiting until network enabled
If I have something to do when the host launched and it requires network, I have to consider that network access not prepared when the something invoked. It is useful to wait network preparation completed. This is a sample.
while true; do GW_CHECK=`netstat -rn -f inet | grep default | wc -l`; if [ 0 -ne $GW_CHECK ];then echo "Network Access enabled, proceed next step."; break; else echo "Network Access not enabled yet, waiting 1 seconds."; sleep 1; fi done # Something I would like to do should be written below