Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ 1 [2] 3 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: simple script to set system clock, not exact as ntp client but good enough< Next Oldest | Next Newest >
humpty Offline





Group: Members
Posts: 655
Joined: Sep. 2005
Posted: Feb. 20 2007,15:08 QUOTE

it looks like telnet needs sudo too;

...
sudo telnet time.nist.gov 13 > nistTime.txt
vFound=$(cat nistTime.txt | grep "UTC(NIST)")
if [ ! -z "$vFound" ]; then
   vDateTime=${vFound:9:2}${vFound:12:2}${vFound:15:2}${vFound:18:2}"20"${vFound:6:2}"."${vFound:21:2}
   date -u
   time1=`date +%s`
   sudo date -u "$vDateTime"
   time2=`date +%s`
   timediff=`expr $time2 - $time1`
   date
   echo corrected by "$timediff" seconds
fi

P.S/
umm,, how do you update this to the fluxbox toolbar ?
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Feb. 20 2007,17:05 QUOTE

If your commands are in a script, you can simply run the script as sudo rather than adding multiple sudo commands to the script.

If fluxbox is not automatically updating, just restart it. You don't need to restart x if this is done from the Fluxbox confguration submenu, so you won't lose your open applications.
I think it will update itself if you wait a bit, but i'm not sure about that.

If your script is run from bootlocal (assuming your network is set up automatically), both issues should be handled already.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
humpty Offline





Group: Members
Posts: 655
Joined: Sep. 2005
Posted: Feb. 20 2007,18:53 QUOTE

quite right mikshaw. easy way to force the fluxbox update is to right-click near it so the menu covers it, then left-click on empty space. :)
Back to top
Profile PM 
newOldUser Offline





Group: Members
Posts: 241
Joined: Oct. 2004
Posted: Feb. 21 2007,00:33 QUOTE

Hmmmmm.... interesting..... I don't have to do an sudo telnet.

The machine I wrote this for has a frugal install of DSL version 2.2    I'm not sure why I don't need an 'sudo telnet'


--------------
======== Note =========
The DSL Forum Search default is 'OR'
If you search for "cat dog" you will get all "cat" posts and all "dog" posts.
If you search for "cat AND dog" you will only find results that contain BOTH "cat" and "dog"
Add '*' for wildcards, " cat* and dog* "
Back to top
Profile PM 
humpty Offline





Group: Members
Posts: 655
Joined: Sep. 2005
Posted: Feb. 21 2007,10:08 QUOTE

Quote (newOldUser @ Feb. 21 2007,07:33)
I'm not sure why I don't need an 'sudo telnet'

maybe you don't. just that whenever i don't use sudo, the telnet just hangs there..(?)
Back to top
Profile PM 
11 replies since Feb. 17 2007,17:18 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ 1 [2] 3 >/
reply to topic new topic new poll
Quick Reply: simple script to set system clock

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code