Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Since my Ubuntu system has some problem keeping of track of time, I want to add a bash script somewhere that has the ntpdate ntp.ubuntu.com command in it to reset the time to the correct time when i log in. Where would I put this so the system does this when I login, not boot? Thanks.

share|improve this question
add comment

2 Answers

It's common to put commands like this in the ~/.profile script, which is executed at login.

I'd personally recommend using ntpd instead of ntpdate as it is a service which runs in the background and constantly checks and corrects the time.

To install it, run sudo apt-get remove ntpdate to remove ntpdate, then sudo apt-get install ntpd.

share|improve this answer
    
Both Noted. If you don't mind, how would I go about configuring ntpd once installed? –  UncleNerdicus Nov 5 '12 at 1:36
    
The default configuration should work out of the box. If it doesn't, you can see the official help pages here help.ubuntu.com/12.04/serverguide/NTP.html –  jackweirdy Nov 5 '12 at 12:03
add comment

Have you tried adding it to the Startup Applications in your user?

share|improve this answer
    
I have not, how do you set those? –  UncleNerdicus Nov 5 '12 at 1:22
    
search for Startup Applications in your dash, i dunno if it has been renamed or w/e. It used to be pretty easy to add a new one. If ntpdate needs sudo however, it might not work.. –  Karthik T Nov 5 '12 at 1:23
    
Would you care to make your answer a bit more elaborate? Comments get removed eventually. –  guntbert Feb 14 '13 at 19:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.