summaryrefslogtreecommitdiff
blob: 0bc561c7203c97bc048cfa346a98b6002b9d0a6a (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
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-irc/ircservices/files/ircservices.initd,v 1.1 2011/06/27 23:55:00 binki Exp $

depend() {
	need net
	use ircd
	provide irc-services
}

start() {
	IRCSERVICES_RUNDIR="${IRCSERVICES_PIDFILE%/*}"
	if ! [ -d "${IRCSERVICES_RUNDIR}" ]; then
		ebegin "Creating ${IRCSERVICES_RUNDIR} for ${SVCNAME}"
		mkdir "${IRCSERVICES_RUNDIR}" && chown "${IRCSERVICES_USER}" "${IRCSERVICES_RUNDIR}"
		eend $?
	fi

	ebegin "Starting ${SVCNAME}"
	start-stop-daemon --start --chuid ircservices --exec /usr/bin/ircservices -- \
		-dir=/var/lib/ircservices \
		-log=/var/log/ircservices/ircservices.log
	eend $?
}

stop() {
	ebegin "Stopping ${SVCNAME}"
	start-stop-daemon --stop --pidfile "${IRCSERVICES_PIDFILE}"
	eend $?
}