daily pastebin goal
1%
SHARE
TWEET

Am I Online?

uriel1998 Nov 25th, 2011 116 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # simple wrapper to test and see if you're online so your scripts don't waste your time (or clog your log).
  4. # I test this way because of hotspots that let you *connect* - but you aren't online.
  5.  
  6. cmd="$@"
  7.  
  8. ext_ip=$(/usr/bin/wget -q -O - checkip.dyndns.org | /bin/sed -e 's/[^[:digit:]|.]//g')
  9. len_ext_ip=${#ext_ip}
  10. if [ $len_ext_ip -lt 16 ]; then
  11.     if [ $len_ext_ip -gt 7 ]; then
  12.     exec $cmd
  13.     fi
  14. fi
  15. #echo "$cmd"
  16. #echo "$ext_ip"
  17.  
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top