alpha-quadrant/net-nds/apacheds/files/apacheds.init
2014-06-03 12:12:33 +02:00

81 lines
3.4 KiB
Plaintext

#!/@GENTOO_PORTAGE_EPREFIX@sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
PIDFILE=/@GENTOO_PORTAGE_EPREFIX@var/run/${RC_SVCNAME}.pid
: ${APACHEDS_HOME:=/@GENTOO_PORTAGE_EPREFIX@var/run/${RC_SVCNAME}}
: ${APACHEDS_BASE:=/@GENTOO_PORTAGE_EPREFIX@var/lib/${RC_SVCNAME}}
: ${APACHEDS_TMPDIR:=/@GENTOO_PORTAGE_EPREFIX@var/tmp/${RC_SVCNAME}}
: ${APACHEDS_USER:=apacheds}
: ${APACHEDS_GROUP:=apacheds}
export JAVA_HOME=`java-config ${TOMCAT_JVM:+--select-vm ${TOMCAT_JVM}} --jre-home`
ADS_PWD=/usr/share/apacheds
# Building dynamically the classpath
depend() {
use logger net
}
start() {
ebegin "Starting ${RC_SVCNAME}"
if [ ! -e "${APACHEDS_TMPDIR}" ]; then
eerror "APACHEDS_TMPDIR does not exist. Unable to start tomcat."
eerror "Please see /@GENTOO_PORTAGE_EPREFIX@etc/conf.d/${RC_SVCNAME} for more information."
eend 1
fi
PERM="--group=${APACHEDS_GROUP} --owner=${APACHEDS_USER}"
if [ ! -e "${APACHEDS_HOME}" ]; then
install ${PERM} -d "${APACHEDS_HOME}"
fi
if [ ! -e "${APACHEDS_HOME}/conf" ]; then
install ${PERM} -d "${APACHEDS_HOME}/conf"
install ${PERM} /etc/default/apacheds/* "${APACHEDS_HOME}/conf/"
fi
ADS_CONTROLS="-Dapacheds.controls=org.apache.directory.api.ldap.codec.controls.cascade.CascadeFactory,org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITFactory,org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeFactory,org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsFactory,org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchFactory,org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesFactory,org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory,org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncDoneValueFactory,org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncInfoValueFactory,org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueFactory,org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueFactory"
ADS_EXTENDED_OPERATIONS="-Dapacheds.extendedOperations=org.apache.directory.api.ldap.extras.extended.ads_impl.cancel.CancelFactory,org.apache.directory.api.ldap.extras.extended.ads_impl.certGeneration.CertGenerationFactory,org.apache.directory.api.ldap.extras.extended.ads_impl.gracefulShutdown.GracefulShutdownFactory,org.apache.directory.api.ldap.extras.extended.ads_impl.storedProcedure.StoredProcedureFactory,org.apache.directory.api.ldap.extras.extended.ads_impl.gracefulDisconnect.GracefulDisconnectFactory"
CLASSPATH=
for i in $(ls $ADS_PWD)
do
CLASSPATH=${CLASSPATH}:$ADS_PWD/${i}
done
start-stop-daemon --start \
--quiet --background \
--chdir "${APACHEDS_TMPDIR}" \
--user ${APACHEDS_USER}:${APACHEDS_GROUP} \
--make-pidfile --pidfile ${PIDFILE} \
--exec ${JAVA_HOME}/bin/java \
-- \
${JAVA_OPTS} \
${ADS_CONTROLS} \
${ADS_EXTENDED_OPERATIONS} \
-Dlog4j.configuration=file:${APACHEDS_HOME}/conf/log4j.properties \
-Dapacheds.log.dir=/var/log/${RC_SVCNAME} \
-Djava.io.tmpdir="${APACHEDS_TMPDIR}" \
-classpath "${CLASSPATH}" \
org.apache.directory.server.UberjarMain \
"${APACHEDS_HOME}"
eend $?
}
stop() {
ebegin "Stopping '${RC_SVCNAME}'"
start-stop-daemon --stop \
--quiet --retry=60 \
--pidfile ${PIDFILE}
--signal=3
eend $?
}