LinHES Forums
http://forum.linhes.org/

ntpdate permissions?
http://forum.linhes.org/viewtopic.php?f=5&t=14142
Page 1 of 1

Author:  graysky [ Sun Feb 11, 2007 7:16 pm ]
Post subject:  ntpdate permissions?

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.

Author:  crabby [ Sun Feb 11, 2007 7:38 pm ]
Post subject: 

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!

Author:  mad_paddler [ Mon Feb 12, 2007 4:08 am ]
Post subject: 

I think you need to have the full path to ntpdate in your script.

Author:  graysky [ Mon Feb 12, 2007 5:03 pm ]
Post subject: 

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

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/