View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 4 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: ntpdate permissions?
PostPosted: Sun Feb 11, 2007 7:16 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
I made a simple script that syncs my system time and logs the output so I can track how my clock is drifting (I know ntp-server is built into KM and for this exercise I have disabled it by removing it from the rc.d and from /etc/cron.daily and weekly)

Here's the script
Code:
ntpdate ntp-3.vt.edu >> /var/log/gettime.log

It has been chmodded to 755 and runs fine from the root user when I do it manually. I also chmodded the log file to 666 so any user and read/write to that file.

I have copied it to my /etc/cron.hourly but when I check the log file, it has not been running. The only entry in the log is the one that ran when I manually ran it from root. Anyone know what's going on? I'm assuming that cron runs as root doesn't it?

Finally, if I try to run it from the mythtv user I get this:
Code:
ntpdate[7692]: bind() fails: Permission denied
which I'm taking to be that only root can change the clock.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 11, 2007 7:38 pm 
Offline
Joined: Tue Feb 08, 2005 5:18 pm
Posts: 70
Seems like it should work. The cron.daily scripts are run using run-parts from /etc/crontab. Might want to make sure cron is running.

Code:
$ ps -aef | grep cron
root      4761     1  0 Feb07 ?        00:00:00 /usr/sbin/cron


You could also do 'man run-parts' and see if anything in the man page rings a bell. You could also try adding #!/bin/sh as the very first line of your script and see if that makes a difference (see the other scripts in cron.daily).

Hope that helps.
good luck!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 4:08 am 
Offline
Joined: Sun Jun 12, 2005 2:39 pm
Posts: 464
Location: UK
I think you need to have the full path to ntpdate in your script.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 5:03 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
crabby wrote:
You could also try adding #!/bin/sh as the very first line of your script and see if that makes a difference (see the other scripts in cron.daily).


That was the problem, thanks for the suggestion.

For reference, the script reads
Code:
#!/bin/sh
ntpdate ntp-3.vt.edu >> /var/log/gettime.log

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu