Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The default location of the agent.sh|cmd  Start Script is:
    • /opt/sos-berlin.com/js7/agent/bin/agent.sh for on Unix and

    • C:\Program Files\sos-berlin.com\js7\agent\bin for bin\agent.cmd on Windows.

Usage

Running the Agent Start Script without parameters displays the usage clause:

...

Instance Start Script: agent_<port>.sh, agent_<port>.cmd

Usage

The JS7 Agent includes a template file for an Instance Start Script includes a number of environment variables that can be used adjusted to specify startup parameters.

  • The

...

  • Instance Start Script

...

  • sets a number of environment variables and finally executes the Start Script.
  • In the Instance Start Script you can adjust startup parameters from environment variables, see below.

It is recommended to create an individual Instance Start Script from a the template file as this allows to specify individual startup parameters by use of environment variables. 

Location

  • The default location of the agent_instance.sh-example|cmd-example Instance Start Script template file is:
    • /opt/sos-berlin.com/js7/agent/bin /agent_instance.sh-example on Unix systems and

    • C:\Program Files\sos-berlin.com\js7\agent\bin bin\agent_instance.cmd-example on Windows.
  • Create a copy of the template file and remove the -example extension from the file name. The renamed Instance Start Script will not be overwritten when updating the Agent later on.
  • It is recommended to copy the template file to a new Instance Start Script file with the name agent_<port>.sh|cmd with <port> being the HTTP port used by the Agent (see below).
    • If the Agent installation was performed for on Windows by use of the installer, either in headless mode or in graphical mode, then the installer automatically created this creates the script.
    • If the Agent installation was performed by extracting a .tar.gz/.zip archive then the Instance Start Script has to be created from a copy of the template file.
    • With the Instance Start Script being copied you can adjust startup parameters from environment variables, see below.

Usage

The Instance Start Script can be executed with the same arguments as the Start Script, see above.

Agent Environment Variables

Most environment variables in the Instance Start Script correspond to command line options in the Start Script (explained above). The following environment variables can be used adjusted in the Instance Start Script script:

  • JS7_AGENT_HOME
    • Points to the directory where the JS7 Agent has been installed.
    • Without setting this environment variable the default value is the parent directory of the Agent Start Script.
    • Should you want to start the Agent from a directory different from the Agent installation directory, e.g. by copying the Start Script to some other location, then this environment variable has to be set in order to locate the JS7 Agent installation directory.
    • There is no corresponding command line option.
  • JS7_AGENT_USER
    • Sets the user account that the Agent is operated for. This includes running jobs with the permissions of the specified user account.
    • This setting is available for Unix systems only. For Windows systems, the user account that runs the Windows Service is used.
    • Without setting this environment variable the user account that runs the Start Script is used.
    • This setting can be used when running the Agent Start Script on system startup and shutdown configurations that are executed by root, e.g. in /etc/init.d and corresponding locations or with systemd.
    • There is no corresponding command line option.
  • JS7_AGENT_HTTP_PORT
    • Sets the HTTP port that the Agent is listening to.
    • Indicates which network interfaces the Agent should listen to if a hostname or IP address is specified as e.g. with JS7_AGENT_HTTP_PORT=myHost:4444.
    • If only a port number is specified then the Agent listens to all available network interfaces via HTTP.
    • Without setting this environment variable the port defaults to 4445.
    • Corresponding command line option: --http-port
  • JS7_AGENT_HTTPS_PORT
    • Sets the HTTPS port that the Agent is listening to.
    • Indicates which network interfaces the Agent should listen to if a hostname or IP address is specified as e.g. with JS7_AGENT_HTTPS_PORT=myHost:4443.
    • If only a port number is specified then the Agent listens to all available network interfaces via HTTPS.
    • When using the HTTPS protocol for connections from a Controller consider to allow the HTTP protocol in addition for local connections as with JS7_AGENT_HTTP_PORT=localhost:4445. As the Agent Start Script makes use of an HTTP connection this protocol has to be in place to allow the Agent instance to be started, stopped etc. by its Start Script.
    • Without setting this environment variable the HTTPS protocol is not used.
    • Corresponding command line option: --https-port
  • JS7_AGENT_DATA
    • Points to the location where the Agent finds its configuration data, log data and journals.
    • Without setting this environment variable the default value is JS7_AGENT_HOME/var_<JS7_AGENT_HTTP_PORT>.
    • Corresponding command line option: --data-directory
  • JS7_AGENT_CONFIG_DIR
    • Points to the directory where the Agent finds its configuration data.
    • Without setting this environment variable the default value is JS7_AGENT_DATA/config.
    • Corresponding command line option: --config-directory
  • JS7_AGENT_LOG_DIR
    • Specifies the directory where the Agent log files are created.
    • This setting defaults to the sub-directory logs in the JS7_AGENT_DATA directory.
    • There is no corresponding command line option.
  • JS7_AGENT_PID_FILE_DIR
    • Specifies the directory where the Agent PID file is created.
    • This setting defaults to the directory that is specified with the JS7_AGENT_LOG_DIR environment variable or the log directory default value.
    • There is no corresponding command line option.
  • JS7_AGENT_WORK_DIR
    • Specifies the working directory for the jobs started by the Agent, e.g. ${HOME} or %USERPROFILE%.
    • This setting defaults to JS7_AGENT_HOME.
    • There is no corresponding command line option.
  • JS7_AGENT_KILL_SCRIPT
    • Specifies the location of a "kill script" if an individual script is required.
    • The kill script provides the functionality to kill a task and any child processes of a job.

    • Kill scripts are by default provided from the following locations:
      • JS7_AGENT_DATA/tmp/kill_task.sh for Unix.

      • JS7_AGENT_DATA\tmp\kill_task.cmd for Windows.

    • Corresponding command line option: --kill-script
  • JAVA_HOME
    • Points to the location of the Java Runtime Environment (JRE).
    • Without setting this environment variable Java will be used from the location specified by the system path.
    • Please consider that JAVA_HOME does not point to the location of a JDK but to a JRE directory where the bin/java executable resides, for example if the location of the Java executable is /opt/java/jdk8u202-b08/jre/bin/java then JAVA_HOME=/opt/java/jdk8u202-b08/jre.
    • There is no corresponding command line option.
  • JAVA_OPTIONS
    • Sets Java options, e.g. the Java memory settings for the Agent.
    • Without setting this environment variable the Java options default to '-Xms100m'.
    • Corresponding command line option: --java-options
  • JS7_AGENT_JOB_JAVA_OPTIONS
    • Sets Java options for each JITL job and JVM job that is started by the Agent.

Running the Agent

    • Corresponding command line option: --job-java-options

Individual Environment Variables

In addition to Agent Environment Variables users can add individual environment variables. Such environment variables can be made available for jobs.

Code Block
languagebash
titleUse for Unix
SCRIPT_PATH=/var/scripts
export SCRIPT_PATH
Code Block
languagebash
titleUse for Windows
set SCRIPT_PATH=C:\ProgramData\scripts

Running the Agent

  • SOS does not recommend to run the JS7 Agent as root (for UnixSOS does not recommend to run the JS7 Agent as root (for Unix) or as Administrator (for Windows).
    • In fact the Agent can be operated with administrative privileges which leverages switching to any user account without specifying a password if jobs should be executed for a different user account.
    • However, in compliance-aware environments this is considered an unwanted risk and in any other environments this simply is a bad idea.
  • For Windows the JS7 Agent can switch to a different user account in a compliant way, see JobScheduler Universal Agent - Running jobs as a different user.
  • For Unix use of sudo is recommended is recommended.

The below examples make use of an Instance Start Script agent_4445.sh|cmd that is created from the template file to run the Agent for port 4445.

Starting the Agent

Code Block
languagebash
agent_4445.sh|cmd start [options]

Stopping the Agent

Code Block
languagebash
agent_4445.sh|cmd stop [options]

This command will safely terminate the Agent (recommended).

...

Code Block
languagebash
agent_4445.sh|cmd abort [options]

The Agent process is immediately aborted.

...

Code Block
languagebash
agent_4445.sh|cmd kill [options]

The Agent process is killed.

  • This corresponds to sending SIGKILL with a kill command (Unix) or taskkill command (Windows).
  • Should jobs be running that start detached child processes then it is not guaranteed that child processes will be killed.

...

Code Block
languagebash
agent_4445.sh|cmd restart [options]

...

Code Block
languagebash
agent_4445.sh|cmd status [options]

Should If the Agent be is up and running then this command will result in output such as:

...

The Agent is operable as a Windows Service. The start script Start Script of the Agent allows to install/remove the Windows Service.

The below examples make use of an Instance Start Script agent_4445.cmd that is created from the template file to run the Agent for port 4445.

Installing the Windows Service

Code Block
languagebash
agent_4445.cmd install-service [--http-port=<number>]

...

Code Block
languagebash
agent_4445.cmd start-service [--http-port=<number>]

...

Info

The stop command performs more than a simple stop-service command: the stop command checks whether the Agent was started by the CLI the command line interface or as a Windows Service and stops the Agent accordingly. Therefore there is no stop-service command.

...

Code Block
languagebash
agent_4445.cmd remove-service [--http-port=<number>]

...

  • The Agent log level can be increased using the Agent's Apache ProcRun Demon Service Manager demon/service.
  • For Windows systems this is installed in the Agent's service folder with a name such as js7_agent_<port>w.exe  where <port> is the Agent's HTTP port.
  • Start the ProcRun Manager, select the Logging tab in the Manager interface and set the level to Debug
  • The location of log files is explained above. 
  • Consider to revert a debug log level once you are finished with debugging.

Usage Examples

Running the Agent

...

on Unix

On Unix For Windows® operating systems the location of the Java Runtime Environment and the log directory can be specified like this:

Code Block
languagebash
setexport JAVA_HOME=%ProgramFiles%\Java\jre8
set"/opt/java/jdk8u202-b08/jre"
export JS7_AGENT_LOGS=%ProgramData%\sos-berlin.com\js7\agent\logs
"%ProgramFiles%\"/var/logs/agent"
/opt/sos-berlin.com\/js7\/agent\bin\agent.cmd/bin/agent_4445.sh" start

Running the Agent

...

on Windows

On Windows operating systems For Unix the location of the Java Runtime Environment and the log directory can be specified like this:

Code Block
languagebash
exportset JAVA_HOME="/opt/java/jdk8u202-b08/jre"
export%ProgramFiles%\Java\jre8
set JS7_AGENT_LOGS="/var/logs/agent"
/opt/%ProgramData%\sos-berlin.com\js7\agent\logs
"%ProgramFiles%\sos-berlin.com/\js7/\agent/\bin/\agent_4445.shcmd" start