summaryrefslogtreecommitdiff
blob: d793add87f18d44299a1956e9af4d9bff91c1415 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-irc/ircd-hybrid/files/init.d_ircd,v 1.4 2005/07/20 19:11:02 swegener Exp $

opts="${opts} rehash"

ipv4pid="/var/run/ircd/ircd-ipv4.pid"
ipv6pid="/var/run/ircd/ircd-ipv6.pid"

depend() {
	need net
}

start() {
	if [ "${IPV4_OPTS}" != "no" ]
	then
		ebegin "Starting IRCd-Hybrid7 IPv4 daemon"
		start-stop-daemon --start --quiet --background --chuid hybrid --exec \
			/usr/sbin/ircd-ipv4 -- ${IPV4_OPTS}
		eend $?
	fi

	if [ -x "/usr/sbin/ircd-ipv6" -a "${IPV6_OPTS}" != "no" ]
	then
		ebegin "Starting IRCd-Hybrid7 IPv6 daemon"
		start-stop-daemon --start --quiet --background --chuid hybrid --exec \
			/usr/sbin/ircd-ipv6 -- ${IPV6_OPTS}
		eend $?
	fi
}

stop() {
	if [ -r "${ipv4pid}" ]
	then
		ebegin "Stopping IRCd-Hybrid7 IPv4 daemon"
		start-stop-daemon --stop --quiet --pidfile="${ipv4pid}"
		eend $?
		rm -f "${ipv4pid}"
	fi

	if [ -r "${ipv6pid}" ]
	then
		ebegin "Stopping IRCd-Hybrid7 IPv6 daemon"
		start-stop-daemon --stop --quiet --pidfile="${ipv6pid}"
		eend $?
		rm -f "${ipv6pid}"
	fi
}

rehash() {
	if [ -r "${ipv4pid}" ]
	then
		ebegin "Rehashing IRCd-Hybrid7 IPv4 daemon"
		kill -s SIGHUP $(cat "${ipv4pid}")
		eend $?
	fi

	if [ -r "${ipv6pid}" ]
	then
		ebegin "Rehashing IRCd-Hybrid7 IPv6 daemon"
		kill -s SIGHUP $(cat "${ipv6pid}")
		eend $?
	fi
}