summaryrefslogtreecommitdiff
blob: c938eb0bde8aae5d2854d42c78b1f9109a8910f4 (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
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later

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 --user 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 $?
}