Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-stable
Commits
564afc52
Commit
564afc52
authored
Apr 02, 2003
by
Robert Ricci
Browse files
Run ntpdate before ntpd, so that we start with the correct time.
parent
4e4bee51
Changes
1
Hide whitespace changes
Inline
Side-by-side
tmcd/common/ntpstart
View file @
564afc52
...
...
@@ -26,6 +26,7 @@ BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
sub
fatal
($);
sub
ntpstart
();
sub
ntpdate
();
#
# Turn off line buffering on output
...
...
@@ -45,6 +46,7 @@ my $newfile = "/tmp/ntp.conf.new";
my
$ntpfile
=
"
/etc/ntp.conf
";
my
$driftfile
=
"
/etc/ntp.drift
";
my
$pidfile
=
"
/var/run/ntpd.pid
";
my
$ntpdate
=
"
/usr/sbin/ntpdate
";
my
$debug
=
0
;
#
...
...
@@ -59,6 +61,37 @@ sub ntpstart () {
return
(
$?
>>
8
);
}
#
# Run ntpdate to get the time set correctly before starting ntpd
#
sub
ntpdate
()
{
#
# We need to give -b to set time directly (instead of using adjtime()), and
# give the boss node's name
#
my
(
$bossname
)
=
split
("
",
`
tmcc bossinfo
`);
my
$ntpcmd
=
"
$ntpdate
-b -s
";
if
(
REMOTE
())
{
$ntpcmd
.=
"
-t 5
";
}
$ntpcmd
.=
"
$bossname
";
if
(
$debug
)
{
print
"
$ntpcmd
\n
";
return
0
;
}
system
("
$ntpcmd
");
return
(
$?
>>
8
);
}
#
# First, run ntpdate so that we start out with the time set correctly. If
# it fails, we just warn about it, and let things continue anyway
#
if
(
ntpdate
())
{
warn
"
WARNING: ntpdate failed!
\n
";
}
#
# Ask for setup. If none then we are done. If provided with a drift value
# but no servers/peers, then need to leave the config alone and just
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment