summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-irc/irker/files/irkerd.initd')
-rw-r--r--net-irc/irker/files/irkerd.initd47
1 files changed, 47 insertions, 0 deletions
diff --git a/net-irc/irker/files/irkerd.initd b/net-irc/irker/files/irkerd.initd
new file mode 100644
index 000000000000..246fcf4823b9
--- /dev/null
+++ b/net-irc/irker/files/irkerd.initd
@@ -0,0 +1,47 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+: ${pidfile:=/run/${RC_SVCNAME}.pid}
+
+: ${IRKERD_NICK:=}
+: ${IRKERD_PASSWORD:=}
+: ${IRKERD_LOGFILE:=/var/log/${RC_SVCNAME}.log}
+: ${IRKERD_LOGLEVEL:=0}
+: ${IRKERD_USER:=nobody}
+
+depend() {
+ use net
+}
+
+start () {
+ if [[ ${IRKERD_LOGLEVEL} ]] ; then
+ IRKERD_OPTS="${IRKERD_OPTS} -d ${IRKERD_LOGLEVEL}"
+
+ ewarn "IRKERD_LOGLEVEL is intended to be used for debugging purpose only"
+ ewarn "No logrotate can handle ${IRKERD_LOGFILE}"
+
+ checkpath -f \
+ -o "${IRKERD_USER}" \
+ "${IRKERD_LOGFILE}" \
+ || return 1
+ fi
+
+ if [[ -z "${IRKERD_USER}" ]] ; then
+ die "IRKERD_USER is mandatory"
+ fi
+
+ [[ -n "${IRKERD_LOGFILE}" ]] && IRKERD_OPTS="${IRKERD_OPTS} -l ${IRKERD_LOGFILE}"
+ [[ -n "${IRKERD_NICK}" ]] && IRKERD_OPTS="${IRKERD_OPTS} -n ${IRKERD_NICK}"
+ [[ -n "${IRKERD_PASSWORD}" ]] && IRKERD_OPTS="${IRKERD_OPTS} -p ${IRKERD_PASSWORD}"
+
+ ebegin "Starting ${RC_SVCNAME}"
+ start-stop-daemon --start \
+ --quiet --background \
+ --user "${IRKERD_USER}" \
+ --make-pidfile --pidfile "${pidfile}" \
+ --exec /usr/bin/irkerd \
+ -- ${IRKERD_OPTS} < /dev/null
+ eend $?
+}