Skip to content

Instantly share code, notes, and snippets.

@pdkovacs
Last active April 14, 2020 11:01
Show Gist options
  • Save pdkovacs/fe57f53e68cc128641f2ccec53864377 to your computer and use it in GitHub Desktop.
Save pdkovacs/fe57f53e68cc128641f2ccec53864377 to your computer and use it in GitHub Desktop.
Windows starter script for Apache Directory Service with fixed command line settings
@ECHO off
REM Licensed to the Apache Software Foundation (ASF) under one
REM or more contributor license agreements. See the NOTICE file
REM distributed with this work for additional information
REM regarding copyright ownership. The ASF licenses this file
REM to you under the Apache License, Version 2.0 (the
REM "License"); you may not use this file except in compliance
REM with the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing,
REM software distributed under the License is distributed on an
REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
REM KIND, either express or implied. See the License for the
REM specific language governing permissions and limitations
REM under the License.
IF "%1"=="" GOTO HAVE_0
IF "%2"=="" GOTO HAVE_1
IF "%3"=="" GOTO HAVE_2
:HAVE_0
ECHO No arguments. "start" or "stop" required
GOTO :EOF
:HAVE_1
SET INSTANCE_NAME=default
SET ACTION=%1
GOTO :RUN
:HAVE_2
SET ACTION=%1
SET INSTANCE_NAME=%2
:RUN
SET _path=%~dp0
for %%a in ("%_path%") do SET "p_dir=%%~dpa"
ECHO %p_dir%
for %%a in (%p_dir:~0,-1%) do SET "p2_dir=%%~dpa"
SET ADS_HOME=%p2_dir%
REM Printing instance information
ECHO Starting ApacheDS instance '%INSTANCE_NAME%'...
REM Dynamically build the classpath
SET ADS_CLASSPATH=
for %%i in (%ADS_HOME%\lib\*.jar) do call %ADS_HOME%\bin\cpappend.bat %%i
SET ADS_CONTROLS="-Dapacheds.controls="
SET ADS_EXTENDED_OPERATIONS="-Dapacheds.extendedOperations="
REM Launching ApacheDS
java %ADS_CONTROLS% %ADS_EXTENDED_OPERATIONS%^
-Dlog4j.configuration="file:%ADS_HOME%/instances/%INSTANCE_NAME%/conf/log4j.properties"^
-Dapacheds.log.dir=%ADS_HOME%/instances/%INSTANCE_NAME%/log^
-cp %ADS_CLASSPATH%^
org.apache.directory.server.UberjarMain^
%ADS_HOME%/instances/%INSTANCE_NAME% %ACTION%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment