Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Commit

Permalink
we now cache the ip address for 6 hours, this should resolve #19
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Hann committed Oct 30, 2015
1 parent cdc7af0 commit df2c762
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/archey
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ user=$(whoami)
hostname=$(hostname | sed 's/.local//g')

if [[ "${opt_offline}" = f ]]; then
ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
ipfile="${HOME}/.archey-ip"
if [ -a "$ipfile" ] && test `find "$ipfile" -mmin -360`; then
while read -r line; do
ip="$line"
done < "$ipfile"
else
ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
echo $ip > "$ipfile"
fi
fi

distro="OS X $(sw_vers -productVersion)"
Expand Down

0 comments on commit df2c762

Please sign in to comment.