Skip to content

Instantly share code, notes, and snippets.

@mkdizajn
Last active June 19, 2019 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkdizajn/9b3f0aa077bd69c7dfdf61ea1782684b to your computer and use it in GitHub Desktop.
Save mkdizajn/9b3f0aa077bd69c7dfdf61ea1782684b to your computer and use it in GitHub Desktop.
My bash IP logger (saves all ip addresses in file in my choosen directory
#! /bin/sh
# let it sleep for half a minute..
sleep 30
# get my current mobile IP address!
IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
# move to root dir
cd /home/krex/bin/IPS_TELE2/
# append current IP if not there already
grep -qxF $IP file || echo $IP >> file
# fort file in place
sort -t . -g -o file file
# and => don't worry be happy :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment