Versions Compared

Key

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

...

Invoking the Agent Installation Script without arguments displays the usage clause:


Code Block
languagetext
titleAgent Installer Script: js7_install_agent.sh
Usage: js7_install_agent.sh [Options] [Switches]

  Installation Options:
    --home=<directory>                 | required: directory to which the Agent will be installed
    --data=<directory>                 | optional: directory for Agent data files, default: <home>/var_4445
    --config=<directory>               | optional: directory from which the Agent reads configuration files, default: <data>/config
    --logs=<directory>                 | optional: directory to which the Agent writes log files, default: <data>/logs
    --work=<directory>                 | optional: working directory of the Agent, default: <data>
    --user=<account>                   | optional: user account for Agent daemon, default: $USER
    --release=<release-number>         | optional: release number such as 2.5.0 for download if --tarball is not used
    --tarball=<tar-gz-archive>         | optional: the path to a .tar.gz archive that holds the Agent tarball,
                                       |           if not specified the Agent tarball will be downloaded from the SOS web site
    --patch=<issue-key>                | optional: identifies a patch for an existing Agent installation
    --instance-script=<file>           | optional: path to the Instance Start Script that will be copied to the Agent, default <home>/bin/<instance-script>
    --backup-dir=<directory>           | optional: backup directory for existing Agent home directory
    --log-dir=<directory>              | optional: log directory for log output of this script
    --exec-start=<command>             | optional: command to start the Agent, e.g. 'StartService'
    --exec-stop=<command>              | optional: command to stop the Agent, e.g. 'StopService'
    --return-values=<file>             | optional: path to a file that holds return values such as the path to a log file

  Configuration Options:
    --deploy-dir=<dir>[,<dir>]         | optional: deployment directory from which configuration files are copied to the Agent
    --agent-conf=<file>                | optional: path to a configuration file that will be copied to <config>/agent.conf
    --private-conf=<file>              | optional: path to a configuration file that will be copied to <config>/private/private.conf
    --http-port=<port>                 | optional: specifies the http port the Agent will be operated for, default: 4445
                                                   port can be prefixed by network interface, e.g. localhost:4445
    --https-port=<port>                | optional: specifies the https port the Agent will be operated for
                                                   port can be prefixed by network interface, e.g. batch.example.com:4445
    --pid-file-dir=<directory>         | optional: directory to which the Agent writes its PID file, default: <data>/logs
    --pid-file-name=<file-name>        | optional: file name used by the Agent to write its PID file, default: agent.pid
    --controller-id=<identifier>       | optional: Controller ID, default: controller
    --controller-primary-cert=<file>   | optional: path to Primary/Standalone Controller certificate file
    --controller-secondary-cert=<file> | optional: path to Secondary Controller certificate file
    --keystore=<file>                  | optional: path to a PKCS12 keystore file that will be copied to <config>/private/
    --keystore-password=<password>     | optional: password for access to keystore
    --keystore-alias=<alias-name>      | optional: alias name for keystore entry
    --truststore=<file>                | optional: path to a PKCS12 truststore file that will be copied to <config>/private/
    --truststore-password=<password>   | optional: password for truststore password
    --java-home=<directory>            | optional: Java Home directory for use with the Instance Start Script
    --java-options=<options>           | optional: Java Options for use with the Instance Start Script
    --service-dir=<directory>          | optional: systemd service directory, default: /usr/lib/systemd/system
    --service-file=<file>              | optional: path to a systemd service file that will be copied to <home>/bin/<file>
    --service-name=<identifier>        | optional: name of the systemd service to be created, default js7_agent_<http-port>

    Switches:
    -h | --help                        | displays usage
    --no-install                       | skips Agent installation, performs configuration updates only
    --uninstall                        | uninstalls Agent
    --show-logs                        | shows log output of the script
    --make-dirs                        | creates the specified directories if they do not exist
    --make-service                     | creates the systemd service for the Agent
    --move-libs                        | moves an existing Agent's lib directory instead of removing the directory
    --remove-journal                   | removes an existing Agent's state directory that holds the journal files
    --restart                          | stops a running Agent and starts the Agent after installation
    --abort                            | aborts a running Agent if used with the --restart switch
    --kill                             | kills a running Agent if used with the --restart switch 

...

Install or Update from Download

Code Block
languagebash
titleExample for use of Agent Installation Script
linenumberstrue
./js7_install_agent.sh \
    --release=2.5.2 \
    --home=/home/sos/agent \
    --http-port=4445 \
    --make-dirs

# downloads the release tarball from the SOS Web Site
# creates the home directory if it does not exist
# extracts the tarball to the Agent's home directory
# operates the Agent for HTTP port 4445

Install or Update from Tarball

Code Block
linenumbers
languagebash
titleExample for use of Agent Installation Scripttrue
curl 'https://download.sos-berlin.com/JobScheduler.2.5/js7_agent_unix.2.5.2.tar.gz' -o /tmp/js7_agent_unix.2.5.2.tar.gz

./js7_install_agent.sh \
    --tarball=/tmp/js7_agent_unix.2.5.2.tar.gz \
    --home=/home/sos/agent \
    --http-port=4445 \
    --make-dirs

# downloads the release tarball from the SOS Web Site using curl
# creates the home directory if it does not exist
# extracts the tarball to the Agent's home directory
# operates the Agent for HTTP port 4445

Install or Update using separate Home and Data Directories

Code Block
linenumbers
languagebash
titleExample for use of Agent Installation Scripttrue
./js7_install_agent.sh \
    --release=2.5.2 \ 
    --home=/opt/sos-berlin.com/js7/agent \
    --data=/var/sos-berlin.com/js7/agent \
    --http-port=4445 \
    --make-dirs

# downloads the release tarball from the SOS Web Site  
# suggests use of separate home and data directories for configuration data, log data etc.
# creates the home and data directories if they do not exist
# extracts the tarball to the Agent's home directory
# populates the data directory from initial configuration files
# operates the Agent for HTTP port 4445

Install or Update and Stop/Start using systemd

Code Block
languagebash
titleExample for use of Agent Installation Scriptlinenumberstrue
curl 'https://download.sos-berlin.com/JobScheduler.2.5/js7_agent_unix.2.5.2.tar.gz' -o /tmp/js7_agent_unix.2.5.2.tar.gz

./js7_install_agent.sh \
    --tarball=/tmp/js7_agent_unix.2.5.2.tar.gz \
    --home=/home/sos/agent \
    --http-port=4445 \ 
    --exec-start=StartService \
    --exec-stop=StopService \
    --make-service \
    --make-dirs

# downloads the release tarball from the SOS Web Site using curl
# extracts the tarball to the Agent's home directory
# creates the Agent's systemd service
# stops and starts the Agent's systemd service
# operates the Agent for HTTP port 4445

Install or Update and Stop/Start using Individual Commands

Code Block
languagebash
titleExample for use of Agent Installation Script
linenumberstrue
curl 'https://download.sos-berlin.com/JobScheduler.2.5/js7_agent_unix.2.5.2.tar.gz' -o /tmp/js7_agent_unix.2.5.2.tar.gz

./js7_install_agent.sh \
    --tarball=/tmp/js7_agent_unix.2.5.2.tar.gz \
    --home=/home/sos/agent \
    --http-port=4445 \
    --exec-start="/home/sos/agent/bin/agent_4445.sh start" \
    --exec-stop="/home/sos/agent/bin/agent_4445.sh stop" \
    --make-dirs

# downloads the release tarball from the SOS Web Site using curl
# extracts the tarball to the Agent's home directory
# stops and starts the Agent by individual commands
# operates the Agent for HTTP port 4445

Install or Update and Stop/Start using Instance Start Script

Code Block
languagebash
titleExample for use of Agent Installation Scriptlinenumberstrue
curl 'https://download.sos-berlin.com/JobScheduler.2.5/js7_agent_unix.2.5.2.tar.gz' -o /tmp/js7_agent_unix.2.5.2.tar.gz

./js7_install_agent.sh \
    --tarball=/tmp/js7_agent_unix.2.5.2.tar.gz \
    --home=/home/sos/agent \
    --http-port=4445 \
    --restart \
    --make-dirs

# downloads the release tarball from the SOS Web Site using curl
# extracts the tarball to the Agent's home directory
# stops and starts the Agent from its instance start script <home>/bin/agent_4445.sh
# operates the Agent for HTTP port 4445

Install or Update using Java Home and Java Options

Code Block
languagebash
titleExample for use of Agent Installation Scriptlinenumberstrue
curl 'https://download.sos-berlin.com/JobScheduler.2.5/js7_agent_unix.2.5.2.tar.gz' -o /tmp/js7_agent_unix.2.5.2.tar.gz

./js7_install_agent.sh \
    --tarball=/tmp/js7_agent_unix.2.5.2.tar.gz \
    --home=/home/sos/agent \
    --http-port=4445 \
    --java-home=/opt/java/jdk-11.0.2+9 \
    --java-options="-Xmx512m -Xms256m" \
    --restart \
    --make-dirs

# downloads the release tarball from the SOS Web Site using curl
# extracts the tarball to the Agent's home directory
# specifies the Java version and Java options to be used
# stops and starts the Agent from its instance start script <home>/bin/agent_4445.sh
# operates the Agent for HTTP port 4445

Install or Update with Return Values

Code Block
linenumbers
languagebash
titleExample for use of Agent Installation Scripttrue
curl 'https://download.sos-berlin.com/JobScheduler.2.5/js7_agent_unix.2.5.2.tar.gz' -o /tmp/js7_agent_unix.2.5.2.tar.gz
retval=/tmp/js7_install_agent.$$.tmp

./js7_install_agent.sh \
    --tarball=/tmp/js7_agent_unix.2.5.2.tar.gz \
    --home=/home/sos/agent \
    --http-port=4445 \
    --backup-dir=/tmp/backups \
    --log-dir=/tmp/logs \
    --return-values=$retval \
    --exec-start=StartService \
    --exec-stop=StopService \
    --make-service \
    --make-dirs

log_file=$(cat $retval | grep "log_file" | cut -d'=' -f2)
backup_file=$(cat $retval | grep "backup_file" | cut -d'=' -f2)

# downloads the release tarball from the SOS Web Site using curl
# creates a backup archive and log file
# extracts the tarball to the Agent's home directory
# stops and starts the Agent from its systemd service
# provides return values from a temporary file which includes the path to the log file and to the backup archive
# operates the Agent for HTTP port 4445

Install or Update with Fallback

Code Block
languagebash
titleExample for use of Agent Installation Script
linenumberstrue
curl 'https://download.sos-berlin.com/JobScheduler.2.5/js7_agent_unix.2.5.2.tar.gz' -o /tmp/js7_agent_unix.2.5.2.tar.gz
retval=/tmp/js7_install_agent.$$.tmp

./js7_install_agent.sh \
    --tarball=/tmp/js7_agent_unix.2.5.2.tar.gz \
    --home=/home/sos/agent \
    --http-port=4445 \
    --backup-dir=/tmp/backups \
    --log-dir=/tmp/logs \
    --return-values=$retval \
    --restart \
    --show-logs \
    --make-dirs
 || ( backup=$(cat $retval | grep "backup_file" | cut -d'=' -f2 ) \
      && ( test -e "$backup" ) && \
      ./js7_install_agent.sh \
          --tarball=$backup \
          --home=/home/sos/agent \
          --http-port=4445 \
          --log-dir=/tmp/logs \
          --restart \
          --show-logs )

log_file=$(cat $retval | grep "log_file" | cut -d'=' -f2)
backup_file=$(cat $retval | grep "backup_file" | cut -d'=' -f2)

# downloads the release tarball from the SOS Web Site using curl
# creates a backup archive and log file
# extracts the tarball to the Agent's home directory
# reverts the installation from a backup archive in case of failure
# stops and starts the Agent from its instance start script <home>/bin/agent_4445.sh
# displays log output on termination of the script

Install or Update and Apply Certificates for HTTPS Connections

Code Block
languagebash
titleExample for use of Agent Installation Scriptlinenumberstrue
curl 'https://download.sos-berlin.com/JobScheduler.2.5/js7_agent_unix.2.5.2.tar.gz' -o /tmp/js7_agent_unix.2.5.2.tar.gz

./js7_install_agent.sh \
    --tarball=/tmp/js7_agent_unix.2.5.2.tar.gz
    --home=/home/sos/agent \
    --controller-id=controller \
    --http-port=localhost:4445 \
    --https-port=batch.example.com:4445 \
    --private-conf=/home/sos/agent-deployment/private.conf \
    --controller-primary-cert=/home/sos/agent-deployment/centostest-primary.crt \
    --controller-secondary-cert=/home/sos/agent-deployment/centostest-secondary.crt \
    --keystore=/home/sos/agent-deployment/https-keystore.p12 \
    --keystore-password="jobscheduler" \
    --truststore=/home/sos/agent-deployment/https-truststore.p12 \
    --truststore-password="jobscheduler" \
    --exec-start=StartService \
    --exec-stop=StopService \
    --make-service \
    --make-dirs

# downloads the release tarball from the SOS Web Site using curl
# extracts the tarball to the Agent's home directory
# specifies the Controller ID of the Controller to which the Agent is dedicated
# specifies HTTP port 4445 on the localhost network interface and the same HTTPS port on the server network interface
# specifies the paths to the Primary and Secondary Controller's server certificates if a Controller Cluster is used
#     for a Standalone Controller the --controller-secondary-cert argument is omitted
# deploys the Agent private configuration file which holds references to keystore and truststore
# deploys keystore and truststore files
# stops and starts the Agent's systemd service

...

Renew Certificates for HTTPS Connections

Code Block
languagebash
titleExample for use of Agent Installation Scriptlinenumberstrue
./js7_install_agent.sh \
    --home=/home/sos/agent \
    --controller-id=controller \
    --http-port=localhost:4445 \
    --https-port=batch.example.com:4445 \
    --private-conf=/home/sos/agent-deployment/private.conf \
    --controller-primary-cert=/home/sos/agent-deployment/centostest-primary.crt \
    --controller-secondary-cert=/home/sos/agent-deployment/centostest-secondary.crt \ 
    --keystore=/home/sos/agent-deployment/https-keystore.p12 \
    --keystore-password="jobscheduler" \
    --truststore=/home/sos/agent-deployment/https-truststore.p12 \
    --truststore-password="jobscheduler" \
    --exec-start=StartService \
    --exec-stop=StopService \
    --no-install

# performs no installation but certificate renewal only
# specifies the Controller ID of the Controller to which the Agent is dedicated
# addresses an existing Agent operated for HTTP port 4445 on the localhost network interface and the same HTTPS port on the server network interface
# specifies the paths to the Primary and Secondary Controller's server certificates if a Controller Cluster is used
#     for a Standalone Controller the --controller-secondary-cert argument is omitted
# deploys the Agent private configuration file that holds references to keystore and truststore
# deploys keystore and truststore files
# stops and starts the Agent's systemd service

Patch from Download

Code Block
linenumbers
languagebash
titleExample for use of Agent Installation Scripttrue
./js7_install_agent.sh \
    --release=2.2.3 \
    --patch=JS-1984 \
    --home=/home/sos/agent \
    --http-port=4445 \
    --exec-start=StartService \
    --exec-stop=StopService
 
# downloads the patch tarball from the SOS Web Site 
# extracts the patch tarball to the Agent's home directory
# stores the patch files to the Agent's <home>/lib/patches sub-directory
# stops and starts the Agent's systemd service

Patch from Tarball

Code Block
linenumbers
languagebash
titleExample for use of Agent Installation Scripttrue
curl 'https://download.sos-berlin.com/JobScheduler.2.2/js7_agent_unix.2.2.3.JS-1984.tar.gz' -o /tmp/js7_agent_unix.2.2.3.JS-1984.tar.gz

./js7_install_agent.sh \
    --tarball=/tmp/js7_agent_unix.2.2.3.JS-1984.tar.gz \
    --patch=JS-1984 \
    --home=/home/sos/agent \
    --http-port=4445 \
    --exec-start=StartService \
    --exec-stop=StopService

# downloads the patch tarball from the SOS Web Site using curl
# extracts the patch tarball to the Agent's home directory
# stores patch files to the Agent's <home>/lib/patches sub-directory
# stops and starts the Agent's systemd service

Uninstall

Code Block
languagebash
titleExample for use of Agent Installation Scriptlinenumberstrue
./js7_install_agent.sh \
    --home=/home/sos/agent \
    --http-port=4445 \
    --exec-stop=StopService \
    --uninstall

# stops the Agent's systemd service
# uninstalls the Agent and removes the home and data directories

...