@echo off

rem #  --------------------------------------------------------------
rem #  Company: Software- und Organisations-Service GmbH
rem #  Purpose: Instance Start Script for JS7 Controller
rem #  --------------------------------------------------------------

SETLOCAL
set JS7_CONTROLLER_INSTANCESCRIPT=%~dpnx0

rem ### USAGE OF THIS FILE ##########################################
rem #
rem # This is a template for the JS7 Controller Instance script.
rem # It can be used as Windows service startscript.
rem # Copy this file
rem #
rem # '.\bin\controller_instance.sh-example' 
rem #                             -> '.\bin\controller_instance.sh' 
rem #
rem # and set the variables below.
rem #
rem #################################################################

rem ### SETTINGS ####################################################

rem # JS7 Controller Id
rem # set JS7_CONTROLLER_ID=controller


rem # The Controller can be installed as a Windows Service. The name 
rem # of a Windows Service must be unique. The ControllerId is already
rem # used for the name of the Windows Service. Only in the case that
rem # a Controller cluster is installed on one computer, e.g. the 
rem # standby node must get a suffix, because the ControllerIds are
rem # the same.
rem #
rem # set JS7_SERVICE_NAME_SUFFIX=


rem # Sets the http port for the JS7 Controller.
rem # Without this setting the default port 4444 is used.
rem # If just a port is specified then the JS7 Controller listens to all
rem # available network interfaces. This corresponds to 0.0.0.0:<port>.
rem # Use the form <ip address or hostname>:<port> to indicate
rem # a specific network interface the JS7 Controller should listen to.
rem # The command line option --http-port beats the environment
rem # variable JS7_CONTROLLER_HTTP_PORT.
rem #
rem # set JS7_CONTROLLER_HTTP_PORT=


rem # In addition to the http port an https port for the
rem # JS7 Controller can be specified. If just a port is specified
rem # then the JS7 Controller listens to all available network interfaces.
rem # This corresponds to using 0.0.0.0:<port>.
rem # Use the form <ip address or hostname>:<port> to indicate
rem # a specific network interface the JS7 Controller should listen to.
rem # The command line option --https-port beats the environment
rem # variable JS7_CONTROLLER_HTTPS_PORT.
rem #
rem # set JS7_CONTROLLER_HTTPS_PORT=


rem # Sets the directory used by the JS7 Controller for configuration
rem # files, log files, journal files and temporary files.
rem # This directory has to be unique for any instances of the
rem # JS7 Controller. The default value is JS7_CONTROLLER_HOME\var
rem # Check that the JS7 Controller user account has read/write
rem # permissions for this directory.
rem #
rem # set JS7_CONTROLLER_DATA=


rem # Sets the directory used by the JS7 Controller for configuration
rem # files. The default value is JS7_CONTROLLER_DATA/config
rem # The command line option --config-directory beats the environment
rem # variable JS7_CONTROLLER_CONFIG_DIR
rem # Check that the JS7 Controller user account has read/write
rem # permissions for this directory.
rem #
rem # set JS7_CONTROLLER_CONFIG_DIR=


rem # Sets the directory to which the JS7 Controller stores log files.
rem # The default value is JS7_CONTROLLER_DATA/logs
rem # Check that the JS7 Controller user account has read/write
rem # permissions for this directory.
rem #
rem # set JS7_CONTROLLER_LOGS=


rem # Sets the directory to which the JS7 Controller stores its PID file.
rem # The default value is JS7_CONTROLLER_LOGS
rem # Check that the JS7 Controller user account has read/write
rem # permissions for this directory.
rem #
rem # set JS7_CONTROLLER_PID_FILE_DIR=


rem # Sets the file name to which the JS7 Controller stores its PID.
rem # The default value is controller.pid
rem #
rem set JS7_CONTROLLER_PID_FILE_NAME=


rem # Specifies the Java Runtime Environment to be used by the
rem # JS7 Controller. If JAVA_HOME is not set then Java is used from
rem # the PATH.
rem #
rem # set JAVA_HOME=


rem # With Java 1.8 initial memory allocation has changed,
rem # for details see https://kb.sos-berlin.com/x/aIC9
rem # As a result on start-up of the JS7 Controller the amount of
rem # virtual memory assigned by Java depends on the physical
rem # memory and in most cases is by far too high.
rem # The environment variables JAVA_OPTIONS can be used to apply
rem # memory settings.
rem # The default value for JAVA_OPTIONS is -Xmx500m -Dfile.encoding=UTF-8
rem #
rem # set JAVA_OPTIONS=


rem # Sets the path to a customized watchdog script
rem # The default value is JS7_CONTROLLER_HOME\bin\controller_watchdog.cmd
rem #
rem # set JS7_CONTROLLER_WATCHDOG=


rem #################################################################

if not defined JS7_CONTROLLER_HOME set JS7_CONTROLLER_HOME=%~dp0..

"%JS7_CONTROLLER_HOME%\bin\controller.cmd" %*

ENDLOCAL
