summaryrefslogtreecommitdiff
blob: 393ebf589ebd0ce882a4e568c589b3bb95814e1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/pdnsd/files/pdnsd.online.1,v 1.2 2011/03/28 14:00:21 polynomial-c Exp $

depend() {
	need pdnsd
}

wait_for_socket() {
	local i=0 pdnsd_socket="/var/cache/pdnsd/pdnsd.status"
	while [ $i -lt 10 ]; do
		[ -S "${pdnsd_socket}" ] && return 0
		i=$(($i+1))
		sleep 1s
	done

    	return 1
}

start() {
	wait_for_socket || return 1
	ebegin "Starting pdnsd-online"
	/usr/sbin/pdnsd-ctl -q server all up
	eend $?
}

stop() {
	ebegin "Stopping pdnsd-online"
	/usr/sbin/pdnsd-ctl -q server all down
	eend $?
}