You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Agent Startup

Start Script

Usage

Running the Agent start script without parameters shows the usage clause:

Usage for Unix
Usage: agent.sh command [options] [web services]
  command:
    start           [options]
    start_docker    [options]
    stop            [options]
    abort           [options]
    restart         [options]
    status          [options] [web services]
    kill            [options]
 options:
    -http-port=<[hostname or ip address:]number>     | to listen to a specific host name or ip address if it is specified; default port: 4445, 
    -https-port=<[hostname or ip address:]number>    | 
    -data-directory=<location of data directory>     | default: ./var_4445
    -config-directory=<location of config directory> | default: ./var_4445/config
    -kill-script=<location of kill script>           | default: "./bin/agent_kill_task.sh"; only for start
    -java-options=<java options>                     | default: -Xms100m; see https://kb.sos-berlin.com/x/aIC9
    -job-java-options=<java options>                 | 
 web services:
    overview                                         | default
    task                                             | running Agent tasks
    tunnel                                           | tunnels summary
    tunnel/                                          | list of tunnels
    command                                          | running command summary
    command/                                         | list of running commands (watching file_order_source)
Usage for Windows
Usage: agent.cmd command [options] [web services]
  command:
    start           [options]
    stop            [options]
    abort           [options]
    restart         [options]
    status          [options] [web services]
    kill            [options]
    install-service [options]
    remove-service  [options]
    start-service   [options]
 options:
    -http-port=<[hostname or ip address:]number>     | to listen to a specific host name or ip address if it is specified; default port: 4445, 
    -https-port=<[hostname or ip address:]number>    | 
    -data-directory=<location of data directory>     | default: .\var_4445
    -config-directory=<location of config directory> | default: .\var_4445\config
    -kill-script=<location of kill script> | default: ".\bin\agent_kill_task.cmd"; only for start, debug
    -java-options=<java options>           | default: -Xms100m; see https://kb.sos-berlin.com/x/aIC9
    -job-java-options=<java options>       | 
 web services:
    overview                               | default
    task                                   | running Agent tasks
    tunnel                                 | tunnels summary
    tunnel/                                | list of tunnels
    command                                | running command summary
    command/                               | list of running commands (watching file_order_source)

Command Line Options

  • -http-port=<[hostname or ip address:]number>
    •  is the HTTP port that the Agent is listening to in order to receive requests from a JobScheduler Master:
      • jobscheduler_agent.cmd|sh command -http-port=####
      • where #### is the numeric port.
      • This option can be also used to indicate which network interfaces the JobScheduler Agent should listen to if you specify a hostname or IP address in addition
    • Without this option being used the port defaults to 4445 and the Agent listens to all available network interfaces.
    • Should you want to specify a port then the following precedence applies:
      • First precedence: command line option
      • Second precedence: environment variable JS7_AGENT_HTTP_PORT (see below)
      • Third precedence: use of default value
  • -https-port=<[hostname or ip address:]number>
    •  is the HTTPS port that the Agent is listening to in order to receive requests from a Controller:
      • agent.cmd|sh command -https-port=####
      • where #### is the numeric port.
      • This option can be also used to indicate which network interfaces the Agent should listen to if you specify a hostname or IP address in addition
    • Without this option being used the port defaults to 4445 and the Agent listens to all available network interfaces.
    • Should you want to specify a port then the following precedence applies:
      • First precedence: command line option
      • Second precedence: environment variable SJS7_AGENT_HTTPS_PORT (see below)
      • Third precedence: use of default value
  • -data-directory=<number>
    • Location of the data directory.
    • It has to be unique for all Agent instances
    • Should you want to specify a data directory then the following precedence applies:
      • First precedence: command line option
      • Second precedence: environment variable JS7_AGENT_DATA (see below)
      • Third precedence: use of default value (=JS7_AGENT_HOME/var_<JS7_AGENT_PORT>)
  • -kill-script=<location of kill script>
    • The kill script provides the functionality to kill a task and any child processes.

    • Two kill script is provided from
      • ./bin/jobscheduler_agent_kill_task.sh for Unix.

      • .\bin\jobscheduler_agent_kill_task.cmd for Windows.

    • This option can be used to specify the location of a different "kill script" if required.

    • Should you want to specify a different "kill script" then the following precedence applies:

      • First precedence: command line option
      • Second precedence: environment variable JS7_AGENT_KILL_SCRIPT (see below)
      • Third precedence: use of default value
  • -java-options=<java options>
    • With Java 1.8 the initial memory allocation has changed, for details see How to manage the Java heap space.

    • This option can be used to apply Java options for the Agent, e.g. the memory settings.

    • Without this option being used the Java options default to '-Xms100m'.

    • Should you want to specify the Java options then the following precedence applies:

      • First precedence: command line option
      • Second precedence: environment variable JAVA_OPTIONS (see below)
      • Third precedence: use of default value
  • -job-java-options=<java options>
    • Without this option being used the Java options for each job which is started by the Agent.

    • Should you want to specify the Java options for execution of JITL jobs and JVM jobs then the following precedence applies:

      • First precedence: command line option
      • Second precedence: environment variable JS7_AGENT_JOB_JAVA_OPTIONS (see below)

Environment Startup Script

Usage

Note

Why should a user use environment variables?

Where are they located?

File names for Windows/Linux

Environment Variables

The following environment variables can be used:

  • 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.
  • 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'.
  • JS7_AGENT_JOB_JAVA_OPTIONS
    • sets Java options for each job that is started by the Agent.
  • JS7_AGENT_HOME
    • points to the directory where the JobScheduler Agent has been installed.
    • Without setting this environment variable the default value is the parent directory of the start script.
    • Should you want to start the Agent from a directory different to 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 JobScheduler Agent installation directory.
  • JS7_AGENT_DATA
    • points to the directory where the Agent finds its data directory.
    • Without setting this environment variable the default value is JS7_HOME/var_<JS7_HTTP_PORT>.
  • 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.
    • 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.
  • 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.
    • if only a port number is specified then the Agent listens to all available network interfaces via HTTPS.
    • Without setting this environment variable the HTTPS protocol is not used.
  • JS7_AGENT_USER
    • sets the user account that the Agent is operated for. This includes running jobs with the permissions of the specified user.
    • This setting is available for Unix systems only. For Windows systems, the user account that runs the start script 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 in system start-up and shutdown configurations that are executed by root, e.g. in /etc/init.d or corresponding locations.
  • JS7_AGENT_LOG_DIR
    • sets the directory where the Agent log file is created.
    • This setting defaults to the directory logs in the JS7_AGENT_DATA directory.
  • JS7_AGENT_WORK_DIR
    • sets the working directory for the jobs started by the Agent, e.g. ${HOME} or %USERPROFILE%.
    • This setting defaults to JS7_AGENT_HOME.
  • JS7_AGENT_KILL_SCRIPT
    • sets the location of a "kill script" if required.
    • The kill script provides the functionality to kill a task and any child processes.

    • Kill scripts are provided by
      • ./bin/jobscheduler_agent_kill_task.sh for Unix.

      • .\bin\jobscheduler_agent_kill_task.cmd for Windows.

  • JS7_AGENT_PID_FILE_DIR
    • sets 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.

Running the Agent

  • SOS does not recommend running the JS7 Agent as root (for Unix) or as Administrator (for Windows).

Starting the Agent

agent.cmd|sh start [options]

Stopping the Agent

agent.cmd|sh stop [options]

This command will safely terminate the Agent (recommended).

  • The Agent waits for running processes to be completed.


agent.cmd|sh abort [options]

The Agent process is terminated immediately.

  • Any running tasks and child processes are killed immediately with a SIGKILL signal.
  • Should tasks use resources such as database connections then they will not be properly closed.


agent.cmd|sh kill [options]

The Agent process is killed.

  • This corresponds to sending SIGKILL with a kill command.
  • Should jobs be running that started detached child processes then it is not guaranteed that child processes will be killed.

Restarting the Agent

agent.cmd|sh restart [options]

Checking the Agent Status

agent.cmd|sh status [options]

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

isTerminating: false
system:
  hostname: agenthost
  mxBeans:
    operatingSystem:
      processCpuLoad: 2.5630713121704744E-5
      availableProcessors: 4
      freePhysicalMemorySize: 311668736
      systemCpuLoad: 0.046373903924522855
      committedVirtualMemorySize: 4475301888
      totalPhysicalMemorySize: 3155517440
java:
  systemProperties:
    java.vendor: Oracle Corporation
    os.arch: amd64
    os.version: 2.6.32-220.17.1.el6.x86_64
    os.name: Linux
    java.version: 1.8.0_31
version: 1.10.0-SNAPSHOT (6956c56a535d15fcf659f293c42d22dcf92e9e12 2015-07-15 21:23:24+02:00)
startedAt: '2015-07-17T08:38:30.516Z'
totalTaskCount: 21
currentTaskCount: 0

Windows Service Interface

The following information applies to batch installation on Windows systems. For installation with a GUI and user dialog see JobScheduler Universal Agent - Installation with Windows Installer.

The Agent is operable as a Windows Service. The start script of the Agent allows installing/removing the Windows Service.

Installing the Windows Service

agent.cmd install-service [-http-port=<number>] [-ip-address=<hostname or ip address>]

This command installs the Agent's Windows Service. After the installation, you find the Windows Service with the name SOS JS7 Agent -port=<number> in the Services Manager Console. The Windows service uses the "local system" account.

During the service installation, it tries to copy the executable file for the Windows Service to the .\service directory. This operation could fail with the error "Access denied" if you have extracted the Agent to e.g. C:\Program Files. In this case you can change the permissions of the .\service directory or open the command prompt with elevated administrator rights and execute the above command once more.

Starting the Windows Service

agent.cmd start-service [-http-port=<number>]

This command starts the Windows Service with the name SOS JS7 Agent -port=<number>.

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

Removing the Windows Service

agent.cmd remove-service [-http-port=<number>]

This command removes the Windows Service. After executing this command you will not find the Windows Service with the name SOS JS7 Agent -port=<number> in the Services Manager Console any longer.

During removal of the service it tries to remove the executable file of the Windows Service from the .\service directory. This operation could fail with the error "Access denied" if you have extracted the Agent to e.g. C:\Program Files. In this case you can change the permissions of the .\service directory or open the command prompt with elevated administrator rights and execute the above command once more.

Configuring the Windows Service

After the installation of the Windows Service you will find the .\service\sos_js7_agent_<http-port>w.exe file. Start this program to configure the Windows Service.

For example go to the "Startup" tab
to modify the start parameter

  • No labels