diff options
Diffstat (limited to 'net-nds/389-ds-base/files/389-ds.initd')
-rw-r--r-- | net-nds/389-ds-base/files/389-ds.initd | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/net-nds/389-ds-base/files/389-ds.initd b/net-nds/389-ds-base/files/389-ds.initd new file mode 100644 index 000000000000..6cb417ee4127 --- /dev/null +++ b/net-nds/389-ds-base/files/389-ds.initd @@ -0,0 +1,74 @@ +#!/sbin/runscript +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-nds/389-ds-base/files/389-ds.initd,v 1.1 2010/07/07 14:31:36 lxnay Exp $ + +DIRSRV_EXEC="/usr/sbin/ns-slapd" +PID_DIRECTORY="/var/run/dirsrv" +DIRSRV_CONF_DIR="/etc/dirsrv" +DS_INSTANCES=${DIRSRV_CONF_DIR}/slapd-* +F389DS_INSTANCES="" + +depend() { + need net + use dns + provide dirsvr ldap +} + +checkconfig() { + if [ -z "${DS_INSTANCES}" ]; then + eerror "389 Directory Server has not been configured." + eend 1 + return 1 + fi +} + +start() { + checkconfig || return 1 + + for instance in ${DS_INSTANCES}; do + instance=$(basename ${instance}) + ebegin "Starting 389 Directory Server: instance ${instance}" + start-stop-daemon --start --quiet -m \ + --pidfile ${PID_DIRECTORY}/${instance}.startpid \ + --exec ${DIRSRV_EXEC} -- -D ${DIRSRV_CONF_DIR}/${instance} \ + -i ${PID_DIRECTORY}/${instance}.pid \ + -w ${PID_DIRECTORY}/${instance}.startpid + sts=${?} + eend ${?} + if [ "${sts}" != "0" ]; then + return 1 + fi + done +} + + + +stop() { + checkconfig || return 1 + + for instance in ${DS_INSTANCES}; do + instance=$(basename ${instance}) + ebegin "Stopping 389 Directory Server: instance ${instance}" + start-stop-daemon --stop --quiet \ + --pidfile ${PID_DIRECTORY}/${instance}.pid \ + --exec ${DIRSRV_EXEC} + eend ${?} + done +} + +status() { + for instance in ${DS_INSTANCES}; do + instance=$(basename ${instance}) + if [ -e ${PID_DIRECTORY}/${instance}.pid ]; then + pid=$(cat ${PID_DIRECTORY}/${instance}.pid) + if [ $(echo "$pid" | grep -c $pid) -ge 1 ]; then + einfo "389 Directory Server: instance ${instance} (pid $pid) running." + else + ewarn "389 Directory Server: instance ${instance} (pid $pid) NOT running." + fi + else + eerror "389 Directory Server: instance ${instance} is NOT running." + fi + done +} |