Debian Codegraph @

support/init.d.examples/ntpd.in

raw
1 #!@SBINDIR@/openrc-run
2 # Copyright (c) 2007-2015 The OpenRC Authors.
3 # See the Authors file at the top-level directory of this distribution and
4 # https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
5 #
6 # This file is part of OpenRC. It is subject to the license terms in
7 # the LICENSE file found in the top-level directory of this
8 # distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
9 # This file may not be copied, modified, propagated, or distributed
10 # except according to the terms contained in the LICENSE file.
11
12 : ${ntpd_config:=/etc/ntp.conf}
13 : ${ntpd_drift:=/var/db/ntpd.drift}
14
15 command=/usr/sbin/ntpd
16 required_files=$ntpd_config
17 pidfile=/var/run/ntpd.pid
18 command_args="$ntpd_args -c $ntpd_config -f $ntpd_drift -p $pidfile"
19 name="Network Time Protocol Daemon"
20
21 depend()
22 {
23 use dns
24 need localmount
25 after bootmisc ntp-client
26 }
27
28 start_pre()
29 {
30 if [ -n "$ntpd_chroot" ]; then
31 case "$RC_UNAME" in
32 *BSD|DragonFly)
33 if [ ! -c "$ntpd_chroot/dev/clockctl" ]; then
34 rm -f "$ntpd_chroot/dev/clockctl"
35 (cd /dev; /bin/pax -rw -pe clockctl \
36 "$ntpd_chroot/dev")
37 fi
38 ;;
39 esac
40 ln -fs "$ntpd_chroot$ntpd_drift" "$ntpd_drift"
41
42 command_args="$command_args -u ntpd:ntpd -i $ntpd_chroot"
43 fi
44 }