Set of scripts to log the Chumby's public IP address, then display it on a web page
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
# Kenneth Finnegan, 2010 | |
# kennethfinnegan.blogspot.com | |
# | |
# AWK patterns to format alternating lines of date and geoip tags into | |
# single lines of date % ipaddr. | |
# | |
# 2010 12 15: Initial revision | |
/^[MTWSF]/ {printf ( "\n%s %% " ,$0)} | |
/.*"US".*"[0-9.]*"/{printf ("%s",$4)} | |
/.*"[0-9.]*".*"US"/{printf("%s", $2)} |
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 | |
# IP Address display CGI script | |
# Kenneth Finnegan, 2010 | |
# kennethfinnega.blogspot.com | |
# | |
# CGI script to display public IP addresses logged by logip.sh | |
# | |
# 2010 12 15: Initial Revision | |
# 2010 12 18: Removed duplicate IP address listings | |
STUBDIR="/mnt/storage/lighty/opt" | |
LOGDIR="/mnt/storage/logs" | |
ANALYTICS="$STUBDIR/analytics.html.part" | |
ADSENSE_WIDE="$STUBDIR/adsense.wide.html.part" | |
IPADDRFILTER="$STUBDIR/ipaddrformat.awk" | |
IPADDRLOG="$LOGDIR/ipaddr.log" | |
echo "Content-type: text/html" | |
echo "" | |
echo "<html><head><title>Public IP Addr Log</title></head>" | |
echo "<body>" | |
cat $ANALYTICS | |
echo "<pre>" | |
echo " ---- Public IP Address Log ----" | |
awk -F\" -f $IPADDRFILTER $IPADDRLOG | uniq -f 7 | |
echo "" | |
echo "</pre>" | |
cat $ADSENSE_WIDE | |
echo "<pre>" | |
cat /etc/motd | |
echo -e "\t\t\tServed by Kenneth Finnegan's Chumby" | |
echo "</pre></body>" |
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 | |
# Kenneth Finnegan, 2010 | |
# kennethfinnegan.blogspot.com | |
# | |
# Run from cron to capture the current public IP addr and write to | |
# LOGFILE. Install by adding the following line to crontab: | |
# 0 * * * * /path/to/logip.sh | |
# | |
# 2010 12 11: Initial Revision | |
LOGFILE="/mnt/storage/logs/ipaddr.log" | |
date >> $LOGFILE | |
wget -q --output-document=- http://content.chumby.com/geoip |\ | |
grep ip= >> $LOGFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment