SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Politics : PRESIDENT GEORGE W. BUSH -- Ignore unavailable to you. Want to Upgrade?


To: Rick McDougall who wrote (480275)10/23/2003 8:52:40 AM
From: Thomas A Watson  Respond to of 769667
 
[ 4024 ] > timeIP 08:38:01

Clearly suggesting I don't even know the time of day reflects very badly on your intelligence.

The above is the execution of a script I wrote to get the time of day from www.time.gov

The line of interest in that script is
echo `lynx -dump time.gov\?Eastern/d/-5 -connect-timeout 10 |head -3|tail -1 `

And the command date -s `timeIP` will set the clock in a computer to within a second of the time of day.

The actual script is a multifunction script created using arg 0 to control function selection.

[ 4031 ] > cat /usr/local/bin/timeIP
#!/bin/tcsh
#file = /usr/local/bin/IP

# setup up softlinks first time only.
if ( !( -e /usr/local/bin/athIP) ) then
ln -s /usr/local/bin/IP /usr/local/bin/athIP
endif

if ( !( -e /usr/local/bin/ns_IP) ) then
ln -s /usr/local/bin/IP /usr/local/bin/ns_IP
endif

if ( !( -e /usr/local/bin/myIP) ) then
ln -s /usr/local/bin/IP /usr/local/bin/myIP
endif

if ( !( -e /usr/local/bin/linksysIP) ) then
ln -s /usr/local/bin/IP /usr/local/bin/linksysIP
endif

if ( !( -e /usr/local/bin/linkstatIP) ) then
ln -s /usr/local/bin/IP /usr/local/bin/linkstatIP
endif

if ( !( -e /usr/local/bin/linkIP) ) then
ln -s /usr/local/bin/IP /usr/local/bin/linkIP
endif
# gets eastern time for www.tive.gov
if ( !( -e /usr/local/bin/timeIP) ) then
ln -s /usr/local/bin/IP /usr/local/bin/timeIP
endif

if ( !( -e /usr/local/bin/ds_IP) ) then
ln -s /usr/local/bin/IP /usr/local/bin/ds_IP
endif

if ( $1 == "-h" ) then
# [1] is an optional arg to get description and IP.
echo "/usr/local/bin/IP [1] "
echo "/usr/local/bin/ns_IP "url.get.ip" [1] "
echo "/usr/local/bin/athIP [1] "
echo "/usr/local/bin/myIP [1] "
echo "/usr/local/bin/linksysIP [1]"
echo "/usr/local/bin/linkstatIP [1]"
echo "/usr/local/bin/linkIP [1]"
echo "/usr/local/bin/timeIP [1]"
echo "/usr/local/bin/ds_IP ip.address.octet" dsshield.org ip info
exit
endif

# arg 0 is the name of command.
set command=`echo $0 | awk -F/ '{print $NF}' `

if ( $command == ns_IP ) then
if ( $1 == "") then
echo 0
exit
endif
set current_ip = `nslookup -sil $1 | grep Address |tail -1 |awk '{print $2}' `
if ( $2 == 1 ) then
echo Current nslookup IP for acute.ath.cx $current_ip
else
echo $current_ip
endif
exit
endif

if ( $command == athIP ) then
set current_ip = `lynx -auth -dump members.dyndns.org -connect_timeout 10 | grep Database `
if ( $1 == 1 ) then
echo Current IP for acute.ath.cx $current_ip
else
set output=`echo $current_ip |awk '{print $4}'`
echo $output
endif
endif

if ( $command == myIP ) then
set command=IP
endif

if ( $command == IP ) then
if ( $1 == 1 ) then
echo lynx -dump checkip.dyndns.org
lynx -dump checkip.dyndns.org -connect-timeout 10
else
set current_ip = `lynx -dump checkip.dyndns.org -connect-timeout 10 | grep Address| awk '{print $4}'`
echo $current_ip
endif
endif

if ( $command == linksysIP ) then

if ( -e /tmp/status.html ) then
rm -f /tmp/status.html
endif

#set hide to hide all error output but create /tmp/status.html
set hide=`wget --http-user="" --http-passwd= --dot-style=text 192.168.1.1 -O /tmp/status.html >&! /dev/null`
if ( -e /tmp/status.html ) then
set CURRENT_IP=`lynx -dump file:/tmp/status.html | grep "IP Address" | grep -v 192.168.1.1`
echo $CURRENT_IP | awk '{print $3}'
else
killall xmessage >& /dev/null
xmessage -fg yellow -bg red linksysIP ERROR_no_status.html&
echo 0
endif
endif

if ( $command == linkIP ) then

if ( -e /tmp/status.html ) then
rm -f /tmp/status.html
endif

set CURRENT_IP=`lynx -auth= -dump obtuse.watman.com -connect-timeout 10 | grep Address | tail -1`

if ( $1 == 1 ) then
echo "lynx -auth= -dump obtuse.watman.com | grep Address | tail -1"
else
set CURRENT_IP=` echo $CURRENT_IP | awk '{print $3}'`
endif

set getIPgoog=`echo $CURRENT_IP | awk -F. '{print NF}' |grep 4 |wc -l`
if ( $getIPgoog ) then
echo $CURRENT_IP
else
killall xmessage >& /dev/null
xmessage -fg yellow -bg red linkIP ERROR_no_status.html&
echo 0
endif
endif

if ( $command == linkstatIP ) then

if ( -e /tmp/status.html ) then
rm -f /tmp/status.html
endif
#set hide to hide all error output but create /tmp/status.html
set hide=`wget --http-user="" --http-passwd= --dot-style=text 192.168.1.1 -O /tmp/status.html >&! /dev/null`
if ( -e /tmp/status.html ) then
set CURRENT_STATUS=`lynx -dump file:/tmp/status.html | grep "Connected" | wc -l`
echo $CURRENT_STATUS
else
echo 0
endif
endif

if ( $command == timeIP ) then
if ( $1 == 1 ) then
echo time.gov\?Eastern/d/-5 |head -5
lynx -dump time.gov\?Eastern/d/-5 -connect-timeout 10 |head -5
else
echo `lynx -dump time.gov\?Eastern/d/-5 -connect-timeout 10 |head -3|tail -1 `
endif
exit
endif

if ( $command == ds_IP ) then
if ( $1 == "" ) then
echo Usage:
echo /usr/local/bin/ds_IP {ip.address.octet}
else
lynx -dump dshield.org\?ip\=$1\&Submit=Submit
endif
exit
endif

# lynx -dump thirdring.net | head -19 |tail -1

# lynx -dump thirdring.net | head -19 |tail -3
# Your Currently Assigned IP Address is:
#
# 64.252.177.76

# lynx -dump ip-calculator.com | head -31 |tail -1
# Your IP address is 64.252.177.76

#lynx -dump techsupportfree.com | head -54 |tail -1

#lynx -dump techsupportfree.com | head -54 |tail -3
# Your IP Address is:
#
# 64.252.177.76

# lynx -dump netins.net | head -17 |tail -1

# lynx -dump netins.net | head -17 |tail -3
# Your current IP Address is:
#
# 64.252.179.98

#lynx -dump showmyip.com | head -3 |tail -1
[ 4032 ] >