summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-irc/psybnc/files/psybnc.initd')
-rw-r--r--net-irc/psybnc/files/psybnc.initd42
1 files changed, 42 insertions, 0 deletions
diff --git a/net-irc/psybnc/files/psybnc.initd b/net-irc/psybnc/files/psybnc.initd
new file mode 100644
index 000000000000..d82f09c95d9f
--- /dev/null
+++ b/net-irc/psybnc/files/psybnc.initd
@@ -0,0 +1,42 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+}
+
+check_config() {
+ if [[ ! -f ${PSYBNC_CONFIG} ]]
+ then
+ eerror "Please set \$PSYBNC_CONFIG in /etc/conf.d/psybnc!"
+ return 1
+ fi
+
+ if [[ ! -d "${PSYBNC_HOME}" ]]
+ then
+ eerror "Please set \$PSYBNC_HOME in /etc/conf.d/psybnc!"
+ return 1
+ fi
+
+ if [[ -z "${PSYBNC_USER}" ]]
+ then
+ eerror "Please set \$PSYBNC_USER in /etc/conf.d/psybnc!"
+ return 1
+ fi
+}
+
+start() {
+ check_config || return 1
+ ebegin "Starting psyBNC"
+ start-stop-daemon --start --quiet --chuid "${PSYBNC_USER}" --chdir "${PSYBNC_HOME}" --exec /usr/bin/psybnc -- "${PSYBNC_CONFIG}" &>/dev/null
+ eend $?
+}
+
+stop() {
+ check_config || return 1
+ ebegin "Stopping psyBNC"
+ start-stop-daemon --stop --quiet --pidfile "${PSYBNC_HOME}"/psybnc.pid --signal 9
+ eend $?
+}