1 | #!/sbin/runscript |
---|
2 | # Copyright 1999-2004 Gentoo Foundation |
---|
3 | # Distributed under the terms of the GNU General Public License v2 |
---|
4 | # $Header: /var/cvsroot/gentoo-x86/net-misc/openntpd/files/openntpd.rc,v 1.7 2008/10/10 09:40:10 bangert Exp $ |
---|
5 | |
---|
6 | depend() { |
---|
7 | need net |
---|
8 | after ntp-client |
---|
9 | use dns logger |
---|
10 | } |
---|
11 | |
---|
12 | checkconfig() { |
---|
13 | if [ ! -f /etc/ntpd.conf ] ; then |
---|
14 | eerror "Could not find /etc/ntpd.conf!" |
---|
15 | return 1 |
---|
16 | fi |
---|
17 | |
---|
18 | if [ -x /usr/bin/getent ] ; then |
---|
19 | if [ "`getent passwd ntp | cut -d: -f 6`" != "${NTPD_HOME}" ] ; then |
---|
20 | eerror "Home directory of ntp needs to be ${NTPD_HOME}" |
---|
21 | eerror "Please run 'usermod -d ${NTPD_HOME} ntp'" |
---|
22 | return 1 |
---|
23 | fi |
---|
24 | fi |
---|
25 | |
---|
26 | return 0 |
---|
27 | } |
---|
28 | |
---|
29 | start() { |
---|
30 | checkconfig || return $? |
---|
31 | |
---|
32 | ebegin "Starting ntpd" |
---|
33 | start-stop-daemon --start --exec /usr/sbin/ntpd --name ntpd -- ${NTPD_OPTS} |
---|
34 | eend $? "Failed to start ntpd" |
---|
35 | } |
---|
36 | |
---|
37 | stop() { |
---|
38 | ebegin "Stopping ntpd" |
---|
39 | start-stop-daemon --stop --exec /usr/sbin/ntpd --name ntpd --user root |
---|
40 | eend $? "Failed to stop openntpd" |
---|
41 | } |
---|