Advertisement
uriel1998

external online or not from bash

Feb 10th, 2012
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.30 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # I run this from cron to be an independent "am I online or not", piping output to /tmp/netup
  4.  
  5. ext_ip=$(wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]|.]//g')
  6. len_ext_ip=${#ext_ip}
  7.  
  8. #echo "$len_ext_ip"
  9.  
  10. if [ $len_ext_ip -gt 16 ]; then
  11.     echo "0.0.0.0"
  12. else
  13.     echo "$ext_ip"
  14. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement