Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'GeekTool - Ideas of using it' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
GeekTool - Ideas of using it
Authored by: Gfx on Jul 07, '04 05:01:04PM

Beside using it to display some log files and uptime, I also use it to monitor the availability of the different servers (POP3, Mail, HTTP, etc) I need to be up all the time. When all "lights" are green then everything is ok, if a light turns red then I need to check that particular server.

I also use it to display my external IP (I have a router and my IP is dynamic) so I can have it handy all the time.

I'm still looking for other useful stuff thatI could do with it. Anyone has more tricks/ideas?



[ Reply to This | # ]
GeekTool - Ideas of using it
Authored by: maddys_daddy on Jul 07, '04 06:27:23PM

What command do you use to display your external IP? Is it ifconfig? If so, what command line options do you supply? I couldn't get ifconfig to do this for me, which is why I'm asking.



[ Reply to This | # ]
GeekTool - Ideas of using it
Authored by: Gfx on Jul 07, '04 09:55:41PM
To get your external IP when using a router, you need to get it from outside (a few websites provides such a service) or use your access to your router (much harder to simply get only the IP).

This is the code I use to get my external IP:

curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'
It would be also possible to make a little script to use the output of http://www.showmyip.com/simple/ but remember that they limit you to 300 requests per day.

I hope this helps.

[ Reply to This | # ]

GeekTool - Ideas of using it
Authored by: mrchaotica on Jul 09, '04 01:42:23AM

I've made myself a little shell script to show me useful status information (date, quote-of-the-day, battery charge, uptime, CPU temperature, disk usage, and now external IP (thanks Gfx!))

Note that battery status and CPU temp use external programs, and I'm not sure if they're redistributable - I'm pretty sure I grabbed them out of some Konfabulator widgets or something, if you want to try to find them. Also, QOTD just reads a file that I created by calling fortune in a cron job, so set that up if you want to use it.

Anyway, here's the script:

#!/bin/sh

# Jack's Ultimate Status Script
# Prints battery status, uptime, CPU temperature,
# time and date, external IP, disk usage, and QOTD

# input escape characters in emacs with ctrl-q <esc>

date
echo Quote of the Day:
echo `cat ~/QOTD` 
#/usr/local/bin/battery 
BATT=$(/usr/local/bin/battery compact | awk '{print $4 " " $9}')
BATT1=$(echo $BATT | awk '{print $1}')
BATT2=$(echo $BATT | awk '{print $2}')
BATT2INT=` echo $BATT2 | sed s/\..$//g `
if [ $BATT1 -eq 00000111 ]; then
	echo Battery charge: ${BATT2}%  \[charging\]
else
    if (( $BATT2INT < 20 )); then
	echo Battery charge: ${BATT2}%
    elif (( 20 < $BATT2INT < 50 )); then
	echo Battery charge: ${BATT2}%
    else
	echo Battery charge: ${BATT2}%
    fi
fi


#PRINT UPTIME
UPTIME=$(uptime)
UPDAY=$(echo $UPTIME | awk '{ print $3 }')
UPHOUR=$(echo $UPTIME | awk '{ print $5 }' | sed s/:.*//g)
UPMIN=$(echo $UPTIME | awk '{ print $5 }' | sed s/.*://g | sed s/,//g)
echo Uptime: $UPDAY days, $UPHOUR hours, $UPMIN minutes

# PRINT CPU TEMPERATURE INFO
TEMP=`/usr/local/bin/tempSensor -f`
TEMPINT=` echo $TEMP | sed s/\..$//g `
if (( $TEMPINT > 140 )) ; then
    echo CPU Temp: $TEMP degrees Fahrenheit
elif (( 130 < $TEMPINT < 140 )) ; then
    echo CPU Temp: $TEMP degrees Fahrenheit
else
    echo CPU Temp: $TEMP degrees Fahrenheit
fi

#PRINT DISK USAGE INFO
df -h | grep disk0s9 | awk '{print "Macintosh HD:", $2, "total,", $3, 
"used,", $4, "remaining"}'

#PRINT EXTERNAL IP ADDRESS
echo External IP: `curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'`

exit 0

By the way, the little box characters are escape characters; they denote ANSI color escape codes, which don't work in GeekTool. The easiest thing would just be to delete them.



[ Reply to This | # ]
GeekTool - Ideas of using it
Authored by: gent99 on Jul 09, '04 08:01:21AM

i would like to use this script, but i don't have /usr/local/bin/battery and /usr/local/bin/tempSensor here

Where can i get those commands?



[ Reply to This | # ]
GeekTool - Ideas of using it
Authored by: cyberwraith on Jul 09, '04 11:55:37PM

I like the idea of the icons (green = up) for servers and such, I used ping x.x.x.x but that did not have the desired effect. Nor could I get the icons to appear, care to share your secret here?



[ Reply to This | # ]