diff options
author | Jeroen Roovers <jer@gentoo.org> | 2013-02-04 12:27:53 +0000 |
---|---|---|
committer | Jeroen Roovers <jer@gentoo.org> | 2013-02-04 12:27:53 +0000 |
commit | 508c7ecb124586b9b82daad027561ec23d042741 (patch) | |
tree | 2c2ba18f20c2e0a326cdd93bb090f15d58e072f8 /net-misc/chrony/files | |
parent | Version bump for the 3.7 series (diff) | |
download | historical-508c7ecb124586b9b82daad027561ec23d042741.tar.gz historical-508c7ecb124586b9b82daad027561ec23d042741.tar.bz2 historical-508c7ecb124586b9b82daad027561ec23d042741.zip |
Version bump.
Package-Manager: portage-2.2.0_alpha161/cvs/Linux x86_64
Manifest-Sign-Key: 0xA792A613
Diffstat (limited to 'net-misc/chrony/files')
-rw-r--r-- | net-misc/chrony/files/chronyd.init | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/net-misc/chrony/files/chronyd.init b/net-misc/chrony/files/chronyd.init new file mode 100644 index 000000000000..c06a82288c27 --- /dev/null +++ b/net-misc/chrony/files/chronyd.init @@ -0,0 +1,66 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/chrony/files/chronyd.init,v 1.1 2013/02/04 12:27:46 jer Exp $ + +depend() { + use dns +} + +checkconfig() { + # Note that /etc/chrony/chrony.keys is *NOT* checked. This + # is because the user may have specified another key + # file, and we don't want to force the user to use that + # exact name for the key file. + if [ ! -f "${CFGFILE}" ] ; then + eerror "Please create ${CFGFILE} and the" + eerror "chrony key file (usually /etc/chrony/chrony.keys)" + eerror "by using the" + eerror "" + eerror " chrony.conf.example" + eerror " chrony.keys.example" + eerror "" + eerror "files (from the documentation directory)" + eerror "as templates." + return 1 + else + # Actually, I tried it, and chrony seems to ignore the pidfile + # option. I'm going to leave it here anyway, since you never + # know if it might be handy + PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"` + fi + return 0 +} + +setxtrarg() { + if [ -c /dev/rtc ]; then + grep -q '^rtcfile' "${CFGFILE}" && ARGS="${ARGS} -s" + fi + grep -q '^dumponexit$' "${CFGFILE}" && ARGS="${ARGS} -r" + return 0 +} + +start() { + checkconfig || return $? + setxtrarg + + [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid + + ebegin "Starting chronyd" + start-stop-daemon --start --background --quiet \ + --exec /usr/sbin/chronyd \ + --pidfile "${PIDFILE}" \ + -- -f "${CFGFILE}" ${ARGS} + eend $? "Failed to start chronyd" +} + +stop() { + checkconfig || return $? + + [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid + + ebegin "Stopping chronyd" + start-stop-daemon --stop --quiet \ + --pidfile "${PIDFILE}" + eend $? "Failed to stop chronyd" +} |