]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.d/ntpd
This commit was generated by cvs2svn to compensate for changes in r142425,
[FreeBSD/FreeBSD.git] / etc / rc.d / ntpd
1 #!/bin/sh
2 #
3 # $NetBSD: ntpd,v 1.6 2002/03/22 04:33:59 thorpej Exp $
4 # $FreeBSD$
5 #
6
7 # PROVIDE: ntpd
8 # REQUIRE: DAEMON cleanvar
9 # BEFORE:  LOGIN
10 # KEYWORD: nojail
11
12 . /etc/rc.subr
13
14 name=ntpd
15 rcvar=`set_rcvar`
16 command="/usr/sbin/${name}"
17 pidfile="/var/run/${name}.pid"
18 start_precmd="ntpd_precmd"
19 required_files="/etc/ntp.conf"
20
21 ntpd_precmd()
22 {
23         if checkyesno ntpd_sync_on_start; then
24                 rc_flags="-g ${ntpd_flags}"
25         fi
26
27         if [ -z "$ntpd_chrootdir" ]; then
28                 return 0;
29         fi
30
31         # If running in a chroot cage, ensure that the appropriate files
32         # exist inside the cage, as well as helper symlinks into the cage
33         # from outside.
34         #
35         # As this is called after the is_running and required_dir checks
36         # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir}
37         # exists and ntpd isn't running at this point (unless forcestart
38         # is used).
39         #
40         if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then
41                 rm -f "${ntpd_chrootdir}/dev/clockctl"
42                 ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" )
43         fi
44         ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
45
46         #       Change run_rc_commands()'s internal copy of $ntpd_flags
47         #
48         rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"
49 }
50
51 load_rc_config $name
52 run_rc_command "$1"