Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 260806 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/portage/net-irc/unrealircd/files/unrealircd.rc (-6 / +34 lines)
Lines 3-8 Link Here
3
# Distributed under the terms of the GNU General Public License v2
3
# Distributed under the terms of the GNU General Public License v2
4
# $Header: /var/cvsroot/gentoo-x86/net-irc/unrealircd/files/unrealircd.rc,v 1.7 2004/10/09 20:36:31 swegener Exp $
4
# $Header: /var/cvsroot/gentoo-x86/net-irc/unrealircd/files/unrealircd.rc,v 1.7 2004/10/09 20:36:31 swegener Exp $
5
5
6
# Set the pidfile from unrealircd that is hardcoded to this location through the ebuild installation process.
7
UNREALIRCD_PIDFILE=${UNREALIRCD_PIDFILE:-/var/run/unrealircd/ircd.pid}
8
UNREALIRCD_LOGFILE=${UNREALIRCD_LOGFILE:-/var/log/unrealircd/ircd.log}
9
UNREALIRCD_GROUP=${UNREALIRCD_GROUP:-${UNREALIRCD_USER:-unrealircd}}
10
6
opts="reload start stop"
11
opts="reload start stop"
7
12
8
depend() {
13
depend() {
Lines 11-30 Link Here
11
}
16
}
12
17
13
start() {
18
start() {
14
	ebegin "Starting unrealircd"
19
	ebegin "Starting ${SVCNAME}"
20
	# UnrealIRCd do not touch the pidfile if it exists on startup
21
	if [ -f ${UNREALIRCD_PIDFILE} ]; then
22
		ewarn "The file ${UNREALIRCD_PIDFILE} already exists. Maybe ${SVCNAME} crashed, please check ${UNREALIRCD_LOGFILE}"
23
		rm -f ${UNREALIRCD_PIDFILE}
24
	fi
15
	start-stop-daemon --start --quiet --exec /usr/bin/unrealircd \
25
	start-stop-daemon --start --quiet --exec /usr/bin/unrealircd \
16
		--chuid ${UNREALIRCD_USER} -- ${UNREALIRCD_OPTS} &>/dev/null
26
		--chuid ${UNREALIRCD_USER} --group ${UNREALIRCD_GROUP} -- ${UNREALIRCD_OPTS} &>/dev/null
17
	eend $?
27
	eend $?
18
}
28
}
19
29
20
stop() {
30
stop() {
21
	ebegin "Shutting down unrealircd"
31
	ebegin "Shutting down ${SVCNAME}"
22
	killall unrealircd
32
	if [ -f ${UNREALIRCD_PIDFILE} ]; then
33
		start-stop-daemon --stop --quiet --pidfile ${UNREALIRCD_PIDFILE} &>/dev/null
34
	else
35
		ewarn "Can't find ${UNREALIRCD_PIDFILE} trying to stop ${SVCNAME} over his process name."
36
		start-stop-daemon --stop --quiet --name ${SVCNAME} &>/dev/null
37
	fi
23
	eend $?
38
	eend $?
24
}
39
}
25
40
26
reload() {
41
reload() {
27
	ebegin "Re-Loading unrealircd"
42
	ebegin "Re-Loading ${SVCNAME}"
28
	killall -1 unrealircd
43
	if [ -f ${UNREALIRCD_PIDFILE} ]; then
44
		start-stop-daemon --signal HUP --quiet --pidfile ${UNREALIRCD_PIDFILE} &>/dev/null
45
	else
46
		ewarn "Can't find ${UNREALIRCD_PIDFILE} trying to reload ${SVCNAME} over his process name."
47
		start-stop-daemon --signal HUP --quiet --name ${SVCNAME} &>/dev/null
48
		# UnrealIRCd do not recreate the file while rehashing
49
		if [ $? -eq 0 ]; then
50
			ebegin "Recreating ${UNREALIRCD_PIDFILE} for ${SVCNAME} daemon."
51
			echo `pidof ${SVCNAME}` > ${UNREALIRCD_PIDFILE} && \
52
			chown ${UNREALIRCD_USER}:${UNREALIRCD_GROUP} ${UNREALIRCD_PIDFILE} && \
53
			chmod 0600 ${UNREALIRCD_PIDFILE}
54
			eend $?
55
		fi
56
	fi
29
	eend $?
57
	eend $?
30
}
58
}

Return to bug 260806