Versions Compared

Key

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

...

Code Block
languagetext
titleUsage for Unix
Usage: agent.sh command [options] [switches]
  command:
    start           [options]
    start-container [options]
    start-docker    [options]
    stop            [options]
    abortrestart           [options]
    status restart         [options]
    statuscancel          [options]
    kill         switch-over      [options]
     cert            [cert-options]                    | see https://kb.sos-berlin.com/x/jLbAAw
  options:
    --http-port=<[hostnameinterface:]port>  or ip address:]number>     | http network interface and port, default: 4445
    --https-port=<[hostname or ip address:]number>interface:]port>        | https network interface and port, default:
    --data-directory=<location<directory>    of data directory>     | default: /var/sos-berlin.com/js7/agent/var_4445
    --config-directory=<location of config directory><directory>         | default: /var/sos-berlin.com/js7/agent/var_4445/config
    --sigkill-delay=<seconds>              | send SIGTERM and delayed SIGKILL signal, default: 3
    --timeout=<seconds>               | only for stop and restart;| runningtimeout tasksfor willterminating bejobs killed
on Agent stop
    --java-timeoutoptions=<timeout<java >options> 0, in seconds>       | default: -Xms100m -Dfile.encoding=UTF-8; see https://kb.sos-berlin.com/x/uYo7B
  switches: |
 only for stop; if-c timeout| is--curl reached then SIGKILL is sent
    --kill-script=<location of kill script>                | use onlycurl forinstead start
of Java http client

see --java-options=<java options>         https://kb.sos-berlin.com/x/ZqrAAw for more information.



Code Block
languagetext
titleUsage for Windows
Usage: agent.cmd command [options] [switches] 
  command:
    start        | default:  -Xms100m -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j2.asyncLoggerWaitStrategy=Block; see https://kb.sos-berlin.com/x/aIC9
see https://kb.sos-berlin.com/x/fAmGAw for more information.
Code Block
languagetext
titleUsage for Windows
Usage: agent.cmd command [options]
  command:[options]
    stop            [options]
    restart         [options]
    start status          [options]
    cancel start-container [options]
    start-docker    [options]
    switch-over stop    [options]
      start-service   [options]
    abort install-service [options]
        remove-service  [options]
    cert restart           [cert-options]
    status     | see https://kb.sos-berlin.com/x/jLbAAw
   [options]:
    kill--http-port=<[interface:]port>         | http network [options]
interface and port, default: cert4445
    --https-port=<[interface:]port>        [cert-options]| https network interface and     port, default:
    --data-directory=<directory>           | seedefault: https:/var/kb.sos-berlin.com/js7/x/jLbAAw
  options:agent/var_4445
    --httpconfig-port=<[hostname or ip address:]number>directory=<directory>         | default: /var/sos-berlin.com/js7/agent/var_4445/config
    --https-port=<[hostname or ip address:]number>timeout=<seconds>       | default:
    --data-directory=<location of data directory>     | default: /var/sos-berlin.com/js7/agent/var_4445 timeout for terminating jobs on Agent stop
    --configjava-directory=<location of config directory>options=<java options>          | default: -Xms100m -Dfile.encoding=UTF-8; see https:/var/kb.sos-berlin.com/js7/agent/var_4445/configx/uYo7B
  switches:
    --timeout=<timeout > 0, in seconds>c | --curl                | only for stop; if timeout is reached then KILL is sent
 | use  --kill-script=<locationcurl instead of killJava script>http client 

see https://kb.sos-berlin.com/x/ZqrAAw for       | only for start
    --java-options=<java options>                     | default:  -Xms100m -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j2.asyncLoggerWaitStrategy=Block; see https://kb.sos-berlin.com/x/aIC9
see https://kb.sos-berlin.com/x/fAmGAw for more information.

Command Line Options

more information.

Command Line Options

  • --http-port
    • Specifies the HTTP port that the Agent is listening to in order to receive requests from a JS7 Controller. This option can be used to indicate which network interface the JS7 Agent should listen to if a hostname or IP address is specified, for example with --http-port=myhost:4445.
    • Without this option being used the port defaults to 4445 and the Agent listens to all available network interfaces.
    • If a port is specified then the following order of 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
    • Specifies the HTTPS port that
    --http-port=<[hostname or ip address:]number>
    • Specifies the HTTP port that the Agent is listening to in order to receive requests from a JS7 Controller:
    • agent.sh|.cmd --http-port=####

    • where #### is the port number.
    • This option can be . This option can be used to indicate which network interface the JS7 Agent should listen to if a hostname or IP address is specified, for example, with --httphttps-port=myhost:4445.
    • When using the HTTPS protocol for connections from a Controller instance consider additionally allowing the HTTP protocol for local connections as with --http-port=localhost:4445. As the Agent Start Script makes use of an HTTP connection the protocol has to be in place to allow the Agent to be started, stopped, etc. by its Start Script.
    • Without this option being used the port defaults to Without this option being used the port defaults to 4445 and the Agent listens to all available network interfaces.
    • If a port is specified then the following order of precedence applies:
      • First precedence: command line option
      • Second precedence: environment variable JS7SJS7_AGENT_HTTPHTTPS_PORT (see below)
      • Third precedence: use of default value
  • --https-port=<[hostname or ip address:]number>
    • Specifies the HTTPS port that the Agent is listening to in order to receive requests from a Controller:
      • agent.sh|.cmd command --https-port=####

      • where #### is the port number.
      • This option can be used to indicate which network interfaces the Agent should listen to if a hostname or IP address is specified, for example, with --https-port=myhost:4445.
    • When using the HTTPS protocol for connections from a Controller instance consider additionally allowing the HTTP protocol for local connections as with --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 to be started, stopped, etc. by its Start Script.
    • Without this option being used the port defaults to 4445 and the Agent listens to all available network interfaces.
    • If a port is specified then the following order of 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=<location of data directory>
    • Specifies the location of the data directory that usually includes the config, logs, tmp and state directories.
    • This location has to be unique for any Agent instance.
    • If a data directory is specified then the following order of 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>
  • --config-directory=<location of config directory>
    • Specifies the location of the config directory for configuration data.
    • This location has to be unique for any Agent instance.
    • Should a configuration directory be specified then the following order of precedence applies:
      • First precedence: command line option
      • Second precedence: environment variable JS7_AGENT_CONFIG_DIR (see below)
      • Third precedence: use of default value JS7_AGENT_HOME/var_<JS7_AGENT_PORT>
  • --sigkill
    • With the stop and restart commands this option kills any running processes of jobs by use of a SIGKILL signal.

    • The option is available for Agents running on Unix.
  • --timeout
    • With the stop command this option waits for the indicated number of seconds and kills the Agent including any running processes of jobs if the timeout is exceeded.

  • data-directory
    • Specifies the location of the data directory that usually includes the config, logs, tmp and state sub-directories.
    • This location has to be unique for any Agent instance.
    • If a data directory is specified then the following order of 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>
  • --config-directory
    • Specifies the location of the config directory for configuration data.
    • This location has to be unique for any Agent instance.
    • Should a configuration directory be specified then the following order of precedence applies:
      • First precedence: command line option
      • Second precedence: environment variable JS7_AGENT_CONFIG_DIR (see below)
      • Third precedence: use of default value JS7_AGENT_HOME/var_<JS7_AGENT_PORT>
  • --sigkill-delay
    • Specifies the delay for terminating job processes on Unix in case the Agent is terminated. A value --sigkill-delay=5 will specify 5 seconds. Default: 3.
    • When the Agent is crashed or is stopped then remaining job processes and child processes will be forcibly terminated by the JS7 - Agent Watchdog.
      • if the --sigkill-delay option specifies a positive, non-zero value
        • send processes and child processes created by the Agent the SIGTERM signal,
        • wait for the period specified with the --sigkill-delay option,
      • send remaining job processes and child processes the SIGKILL signal.
    • When using JS7 - systemd Service Files for automated Startup and Shutdown with Unix Systems users should consider that --timeout and --sigkill-delay values will count towards the systemd service file's  TimeoutStopSec setting. Users must ensure that the Agent is terminated when the systemd timeout is exceeded.
    • The option is available for Agents running on Unix starting from release 2.7.2, see
      Jira
      serverSOS JIRA
      columnIdsissuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution
      columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
      serverId6dc67751-9d67-34cd-985b-194a8cdc9602
      keyJS-2148
  • --timeout
    • With the stop and restart commands this option waits for the indicated duration and terminates the Agent including job processes if the timeout is exceeded.

    • The option accepts a number of seconds or the never value to wait endlessly for jobs to terminate.
    • When using JS7 - systemd Service Files for automated Startup and Shutdown with Unix Systems users should consider that --timeout and --sigkill-delay values will count towards the systemd service file's  TimeoutStopSec setting. Users must ensure that the Agent is terminated when the systemd timeout is exceeded.
  • --kill-script--kill-script=<location of kill script>
    • The kill script provides the functionality to kill tasks and any child processes of jobs.

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

      • JS7_AGENT_DATA\work\kill_task.cmd for Windows.

    • This option The option can be used to specify the location of an individual kill script if required.

    • Should an individual kill script be specified then the following order of precedence applies:

      • First precedence: command line option
      • Second precedence: environment variable JS7_AGENT_KILL_SCRIPT (see below)
      • Third precedence: use of default value
    • Starting from release 2.7.2 this the option is ignored, see see
      Jira
      serverSOS JIRA
      columnIdsissuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution
      columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
      serverId6dc67751-9d67-34cd-985b-194a8cdc9602
      keyJS-2148
  • --java-options=<java options>
    • This option can be used to apply Java options for the Agent, e.g. for memory settings, see JS7 - FAQ - Which Java Options are recommended.

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

    • In order to specify a number of Java options quotes have to be used like this:
      • --java-options="-Xms100m -Xmx1g"
    • When specifying Java options then the following order of precedence applies:

      • First precedence: command line option
      • Second precedence: environment variable JAVA_OPTIONS (see below)
      • Third precedence: use of default value

Switches

  • -c ,  -job-java-options=<java options>
    • This option can be used to specify Java options for Shell jobs that load a JVM. This option does not apply to jobs derived from JS7 - Job Templates that are executed in the Agent's JVM.
    • In order to specify a number of Java options quotes have to be used like this:
      • --job-java-options="-Xms100m -Xmx1g"
    • When specifying Java options for execution with Shell jobs then the following order of precedence applies:

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

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

  • -curl
    • Specifies that the curl utility should be used instead of the built-in HTTP client when sending commands to the Agent.
  • --sigkill
    • Starting from release 2.7.2 the switch is ignored.

Watchdog Script agent_watchdog.sh, agent_watchdog.cmd

Technically the Agent is started and is restarted from its Watchdog Script, for details see JS7 - Agent Watchdog.

The Watchdog Script is used to terminate job processes and child processes in case that the Agent is crashed.

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

The JS7 Agent includes a template file for an Instance Start Script that can be The JS7 Agent includes a template file for an Instance Start Script that can be adjusted to specify start-up parameters.

...

It is recommended that an individual Instance Start Script is created from the template file as this allows to specify individual start-up parameters to specified using from environment variables.

Location

...

When used for Container operation using Unix OS then the following command is used:

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

This The command is used to start the JS7 Agent in a container:

  • The command will keep the start script running as PID 1 in order to receive later stop/kill signals ( SIGTERM, SIGKILL ) signals from the container management software.
  • The command start-docker is an alias for start-container.
  • Jira
    serverSOS JIRA
    columnIdsissuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keySET-223

...

  • ,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keySET-223

Anchor
#stop_agent
#stop_agent
Stopping the Agent

Code Block
languagebash
# terminate jobs and stop Agent
agent_4445.sh|.cmd stop [options]

# terminate jobs on Unix by sending SIGKILL with a delay of 10s and stop Agent
agent_4445.sh stop --sigkill-delay=10

# wait for jobs to terminate within 60s and stop Agent
agent_4445.sh|.cmd stop --timeout=60

# wait for jobs to terminate and stop Agent
agent_4445.sh|.cmd stop --timeout=never

This command will terminate the Agent.

  • Unix
    • Job processes and child processes will be terminated and the Agent will terminate with exit code 0.
      • collect PIDs of job processes,
      • send SIGTERM signal to remaining job processes and child processes for which PIDs have been collected,
      • wait for the grace timeout specified with the job or for stdout/stderr to be released by processes whichever is earlier,
      • send SIGKILL signal to job processes and child processes,
      • terminate the Agent with exit code 0.
  • Windows
    • Job processes and child processes will be forcibly terminated and the Agent will terminate with exit code 0.
  • Using the --timeout option will wait for the indicated timeout that the Agent terminates. If the timeout is exceeded and if the Agent is still running, then Agent and jobs will be focibly terminated. The option accepts a number of seconds or the never value that indicates that the Agent will wait endlessly until job processes and child processes will terminate.
    • Agent
      • collect PIDs of job processes,
      • terminate the Agent with exit code 143 for Unix and 99 for Windows.
    • Watchdog
      • Unix
        • if the --sigkill-delay option is used
          • send SIGTERM signal to remaining job processes and child processes for which PIDs have been collected,
          • wait for the indicated delay or for stdout/stderr to be released by processes whichever is earlier,
        • send SIGKILL signal to remaining job processes and child processes.
      • Windows
        • forcibly terminate job processes and child processes.


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

The Agent process will terminate.

Starting from release 2.7.2 the command is deprecated and is replaced by the stop command, optionally for Unix using the --sigkill-delay=0 option.


Code Block
languagebash
agent_4445.sh|.cmd cancel | stopkill [options]

This command will safely terminate the Agent (recommended).

...

The Agent process is forcibly terminated.

  • The kill command can be used as an alias to cancel.
  • The command corresponds to sending a SIGKILL signal with a kill -9 OS command (Unix) or taskkill command (Windows) to the Agent.
  • Should jobs be running then they will be terminated by the JS7 - Agent Watchdog similar to crash of the Agent.

Anchor
#restart_agent
#restart_agent
Restarting the Agent

...

Code Block
languagebash
# terminate jobs and restart Agent
agent_4445.sh|.cmd abortrestart [options]

The Agent process is immediately aborted.

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


# terminate jobs on Unix by sending SIGKILL with a delay of 10s and restart Agent
agent_4445.sh|.cmd kill [options]

The Agent process is killed.

  • This corresponds to sending a SIGKILL signal with a kill -9  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.

Restarting the Agent

Code Block
languagebash
restart --sigkill-delay=10

# wait for jobs to terminate and restart Agent
agent_4445.sh|.cmd restart [options]

This command will safely restart the Agent (recommended).

...

--timeout=never

The command will restart the Agent.

  • Job processes and child processes will be terminated and the Agent will terminate as explained in chapter Stopping the Agent.
  • The Agent is started similar to use of the start command using the same options as for initial start.
  • The --timeout option for Unix/Windows and the --sigkill-delay option for Unix can be used.

Anchor
#status_agent
#status_agent
Checking the Agent Status

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

...

Code Block
languagebash
version: 2.0.0-alpha.20210722.2 (2021-07-22)
buildId: QQqWYNiJRbqcYqx4iiFWww
startedAt: 1626981330629
isTerminating: false
system:
  hostname: agent-2-0-primary
  distribution: Alpine Linux v3.13
  cpuModel: Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
  mxBeans:
    operatingSystem:
      availableProcessors: 8
      systemLoadAverage: 0.0107421875
java:
  version: 1.8.0_292
  memory:
    maximum: 954728448
    total: 289931264
    free: 87118936
  systemProperties:
    java.vendor: IcedTea
    os.arch: amd64
    java.runtime.name: OpenJDK Runtime Environment
    os.version: 3.10.0-957.1.3.el7.x86_64
    os.name: Linux
    os java.vm.name: Linux OpenJDK 64-Bit Server VM
    java.vm.name: OpenJDK 64-Bit Server VM
    java.version: 1.8.0_292.version: 1.8.0_292

Switching-over the Active Director Agent Instance

Code Block
languagebash
agent_4445.sh|.cmd switch-over [options]

If an Agent Cluster is operated then the command will switch the active role from the Active Director Agent instance to the Standby Director Agent instance. The command can be executed for the Active Director Agent .

After switch-over the Agent instance is restarted.

Anchor
#cert_agent
#cert_agent
Performing Certificate Rollout

Code Block
languagebash
agent_4445.sh|.cmd cert [cert-options]

This command is used to generate an SSL certificate /TLS Certificate for client and server authentication. 

...

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

This The command installs the Agent's Windows Service. After the installation, users find users 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.

...

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

This The command starts the Windows Service with the name name SOS JS7 Agent -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 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>]

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

...

After installation of the Windows Service users find the.\service\js7_agent_<http-port>w.exe file file. This The program can be executed to configure the Windows Service.

...

Debugging the Windows Service

  • For general information see JS7 - Log Levels and Debug Options
  • The log level can be increased by using the Agent's Apache ProcRun Daemon Service Manager daemon/service.On  On Windows systems this is installed in the Agent's service folder directory with a name such as as js7_agent_<port>w.exe  where <port> is the Agent's HTTP port.
  • Users can start the ProcRun Manager, select the Logging tab in the user interface and set the log level to Debug
  • The For the location of log files is explained above. see JS7 - Log Files and Locations.
  • Users should consider reverting the debug log level to its original value once they are finished with debugging.

Resources