Last active
June 19, 2019 14:05
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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