Versions Compared

Key

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

...

Code Block
languagetext
titleJOC Cockpit Installation Script: js7_install_joc.sh
Usage: js7_install_joc.sh [Options] [Switches]

  Installation Options:
    --setup-dir=<directory>            | optional: directory to which the JOC Cockpit installer will be extracted
    --response-dir=<directory>         | optional: setup response directory holds joc_install.xml and JDBC Drivers
    --release=<release-number>         | optional: release number such as 2.2.3 for download if --tarball is not used
    --tarball=<tar-gz-archive>         | optional: the path to a .tar.gz archive that holds the JOC Cockpit tarball,
                                       |           if not specified the JOC Cockpit tarball will be downloaded from the SOS web site
    --home=<directory>                 | optional: home directory of JOC Cockpit
    --data=<directory>                 | optional: data directory of JOC Cockpit
    --cluster-id=<identifier>          | optional: Cluster ID of the JOC Cockpit instance, default: joc
    --instance-id=<number>             | optional: unique number of a JOC Cockpit instance in a cluster, range 0 to 99, default: 0
    --user=<account>                   | optional: user account for JOC Cockpit daemon, default: current user
    --home-owner=<account[:group]>     | optional: account and optionally group owning the home directory, requires root or sudo permissions
    --data-owner=<account[:group]>     | optional: account and optionally group owning the data directory, requires root or sudo permissions
    --patch=<issue-key>                | optional: identifies a patch for an existing JOC Cockpit installation
    --jar=<jar-file>                   | optional: the path to a .jar file that holds the patch
    --license-key=<key-file>           | optional: specifies the path to a license key file that will be installed
    --license-bin=<binary-file>        | optional: specifies the path to the js7-license.jar binary file for licensed code to be installed
                                       |           if not specified the file will be downloaded from the SOS web site
    --backup-dir=<directory>           | optional: backup directory for existing JOC Cockpit home directory
    --log-dir=<directory>              | optional: log directory for log output of this script
    --exec-start=<command>             | optional: specifies the command to start JOC Cockpit, e.g. 'StartService'
    --exec-stop=<command>              | optional: specifies the command to stop the JOC Cockpit, e.g. 'StopService'
    --return-values=<file>             | optional: specifies a file that receives return values such as the path to a log file

  Configuration Options:
    --deploy-dir=<directory>[,<dir>]   | optional: deployment directories from which configuration files will be copied to <data>/resources/joc
    --properties=<file>                | optional: specifies the joc.properties file that will be copied to <data>/resources/joc/
    --title=<title>                    | optional: title of the JOC Cockpit instance in the GUI, default: joc_install.xml setting
    --security-level=low|medium|high   | optional: security level of JOC Cockpit instance, default: joc_install.xml setting
    --dbms-config=<hibernate-file>     | optional: DBMS Hibernate configuration file, default: joc_install.xml setting
    --dbms-driver=<jdbc-driver-file>   | optional: DBMS JDBC Driver file, default: joc_install.xml setting
    --dbms-init=byInstaller|byJoc|off  | optional: DBMS create objects by installer, on start-up or none, default: joc_install.xml setting
    --http-port=<port>                 | optional: specifies the http port the JOC Cockpit will be operated for, default: 4446
                                                   port can be prefixed by network interface, e.g. localhost:4446
    --https-port=<port>                | optional: specifies the https port the JOC Cockpit will be operated for, default:
                                                   port can be prefixed by network interface, e.g. joc.example.com:4446
    --ini=<ini-file[,ini-file]>        | optional: one or more Jetty config files http.ini, https.ini, ssl.ini etc. will be copied to <data>/start.d/
    --keystore=<path>                  | optional: path to a PKCS12 keystore file that will be copied to <data>/resources/joc/
    --keystore-password=<password>     | optional: password for access to keystore
    --keystore-alias=<alias-name>      | optional: alias name for keystore entry
    --truststore=<path>                | optional: path to a PKCS12 truststore file that will be copied to <data>/resources/joc/
    --truststore-password=<password>   | optional: password for access to truststore

    --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>/jetty/bin
    --service-name=<name>              | optional: name of the systemd service to be created, default js7_joc

  Switches:
    -h | --help                        | displays usage
    -u | --as-user                     | installs configuration directories as current user, other directories as root using sudo
    -E | --preserve-env                | preserves environment variables when switching to root using sudo -E
    --noforce-configsudo                       | force use |of skipssudo JOCfor Cockpitoperations configurationon changesdirectories
     --no-installconfig                        | skips JOC Cockpit installationconfiguration changes
    --no-install                       | skips JOC Cockpit installation, performs configuration changes only
    --uninstall                        | uninstalls JOC Cockpit
    --no-jetty                         | skips Jetty servlet container installation
    --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 JOC Cockpit
    --restart                          | stops a running JOC Cockpit and starts JOC Cockpit after installation
    --kill                             | kills a running JOC Cockpit if used with the --restart switch

...

    • --setup-dir
      • Specifies the directory in which the installer for the JOC Cockpit should be extracted. This is not the JOC Cockpit installation directory but the directory that holds installer files.
    • --response-dir
      • Specifies the directory that holds a copy of  the JOC Cockpit installer joc_install.xml response file and optionally related files. This file is available after extraction of the installer tarball and specifies options for installation of the JOC Cockpit. Files in the response directory are copied to the working directory specified with the --setup-dir option. and are applied when invoking the installer by ./setup.sh -u joc_install.xml, see JS7 - JOC Cockpit - Headless Installation on Linux and Windows.
      • Users should keep their copy of the response file and specify the directory with this command line option. Response files can be re-used within the same minor release of the JOC Cockpit, for example when updating from release 2.2.1 to 2.2.4. When updating, for example, from release 2.2.x to 2.3.x it is recommended to check from the installer tarball if a newer version of the file is available.
      • Users should note that the response file can hold references to a license file and to a JDBC Driver .jar file. The JOC Cockpit setup is executed from the working directory specified with the --setup-dir option. Paths in the joc_install.xml response file can be used relative to the working directory, for example using sos.pem for a license file without specifying a directory if the license file is available in the response directory as it will be copied to the working directory.
    • --release
      • Specifies a release number such as 2.3.1 for download from the SOS web site if the --tarball option is not used.
    • --tarball
      • Optionally specifies the path to a .tar.gz file that holds the JOC Cockpit installation files. If this option is not used the installer tarball will be downloaded from the SOS web site for the release indicated with the --release option.
      • Download is performed with curl which takes account of http_proxy and https_proxy environment variables and the relevant settings from a .curlrc file.
    • --home
      • Specifies the directory in which the JOC Cockpit should be installed.
      • This option overwrites the JOC Cockpit installation directory specified in the joc_install.xml response file with the <installpath> element.
    • --data
      • Optionally specifies the directory in which the JOC Cockpit installs configuration files. If the option is omitted then the home directory will used.
      • If specified then the configuration directory is accessible from the jetty_base symlink in the JOC Cockpit home directory.
      • This option overwrites the JOC Cockpit configuration directory specified in the joc_install.xml response file with the <entry key="jettyBaseDir" value="..."/> element.
    • --user
      • The JOC Cockpit joc_install.xml response file holds the runningUser setting that optionally specifies the user account of the JOC Cockpit daemon service. This setting allows to take precedence over the response file setting.
      • The user account specified will be used for the JOC Cockpit installation. 
    • --patch
      • A patch is identified by the release number to which it is applied which is specified with the --release option and by
        • the JOC Cockpit security level: low, medium, high,
        • a sequential number such as patch-1, patch-2.
        • A patch is specified as --patch=low.patch-1, --patch=low.patch-2, --patch=medium.patch-1 etc.
      • For JOC Cockpit patches are consolidated, i.e. patch-2 includes any patches of patch-1.
      • Patches are downloaded from the SOS web site if the --tarball option is not used.
      • Patches are added to the JOC Cockpit's JETTY_BASE/webapps/joc/WEB-INF/classes directory. When updating JOC Cockpit later on then the classes sub-directory will be emptied.
      • If a backup directory is specified then a JOC Cockpit's existing installation directory will be added to a .tar.gz file in this directory.
    • --jar
      • Optionally specifies the path to a .jar file that holds the patch.
    • --license-key
      • Optionally the path to a license key file is specified. Customers with a Commercial License receive the license key file in .pem or .crt format.
      • For details see JS7 - How to apply a JS7 License Key.
      • This option is an alternative to specifying the license key file with the joc_install.xml response file, see --response-dir option.
    • --license-bin
      • Optionally the path to the js7-license.jar binary file is specified that includes code that is available for use with a Commercial License only, see JS7 - How to apply a JS7 License Key.
      • Should this option be omitted and a license key file be specified with the --license-key option then the binary file is downloaded from the SOS Web Site, see JS7 - Download.
      • This option is an alternative to specifying the license key file with the joc_install.xml response file, see --respons-dir option. If the response files specifies a license key then the binary file for licensed code is automatically installed.
      • Should the the home or data directory be owned by an account that is different from the one running the Agent Installation Script then consider use of the --home-owner and --data-owner options.
    • --home-owner
      • Optionally specifies the user account and group that should own the home directory. By default the home directory is created and owned by the current user account.
      • Syntactically a user account and optionally a group can be specified, for example --home-owner=sos or --home-owner=sos:sos. If the group is not specified then a group with the name of the user account is assumed.
      • Use of this option requires sudo permissions for the user account that runs the JOC Cockpit Installation Script.
    • --data-owner
      • Optionally specifies the user account and group that should own the data directory. By default the data directory is created and owned by the current user account.
      • Syntactically a user account and optionally a group can be specified, for example --data-owner=sos or --data-owner=sos:sos. If the group is not specified then a group with the name of the user account is assumed.
      • Use of this option requires sudo permissions for the user account that runs the JOC Cockpit Installation Script.
    • --patch
      • A patch is identified by the release number to which it is applied which is specified with the --release option and by
        • the JOC Cockpit security level: low, medium, high,
        • a sequential number such as patch-1, patch-2.
        • A patch is specified as --patch=low.patch-1, --patch=low.patch-2, --patch=medium.patch-1 etc.
      • For JOC Cockpit patches are consolidated, i.e. patch-2 includes any patches of patch-1.
      • Patches are downloaded from the SOS web site if the --tarball option is not used.
      • Patches are added to the JOC Cockpit's JETTY_BASE/webapps/joc/WEB-INF/classes directory. When updating JOC Cockpit later on then the classes sub-directory will be emptied.
      • If a backup directory is specified then a JOC Cockpit's existing
      --backup-dir
      • If a backup directory is specified then an existing JOC Cockpit's installation directory will be added to a .tar.gz file in this directory.
      • File names are created according to the pattern: backup_js7_joc.<hostname>.<release>.<yyyy>-<MM>-<dd>T<hh>-<mm>-<ss>.tar.gz
      • For example: backup_js7_joc.centostest_primary.2.3.1.2022-03-19T20-50-45.tar.gz
    • --log-dir
      • If a log directory is specified then the JOC Cockpit Installation Script logs information about processing steps to a log file in this directory.
      • File names are created like this: install_js7_joc.<hostname>.<yyyy>-<MM>-<dd>T<hh>-<mm>-<ss>.log
      • For example: install_js7_joc.centostest_primary.2022-03-19T20-50-45.log
    • --exec-start
      • This option can be used should JOC Cockpit be started after installation. For example, when using systemd then the option --exec-start="StartService" will start the JOC Cockpit service provided that the related systemd service has been created manually or by use of the --make-service switch. Alternatively users can specify individual commands, for example --exec-start="sudo systemctl start js7_joc".
      • For systemd service files see the JS7 - systemd Service Files for automated Startup and Shutdown with Unix Systems article.
      • This option is an alternative for use of the -restart switch that starts the JOC Cockpit from its Start Script. If specified this option overrules the --restart switch.
    • --jar
      • Optionally specifies the path to a .jar file that holds the patch.
    • --license-key
      • Optionally the path to a license key file is specified. Customers with a Commercial License receive the license key file in .pem or .crt format.
      • For details see JS7 - How to apply a JS7 License Key.
      • This option is an alternative to specifying the license key file with the joc_install.xml response file, see --response-dir option.
    • --license-bin
      • Optionally the path to the js7-license.jar binary file is specified that includes code that is available for use with a Commercial License only, see JS7 - How to apply a JS7 License Key.
      • Should this option be omitted and a license key file be specified with the --license-key option then the binary file is downloaded from the SOS Web Site, see JS7 - Download.
      • This option is an alternative to specifying the license key file with the joc_install.xml response file, see --respons-dir option. If the response files specifies a license key then the binary file for licensed code is automatically installed.
    • --backup-dir
      • If a backup directory is specified then an existing JOC Cockpit's installation directory will be added to a .tar.gz file in this directory.
      • File names are created according to the pattern: backup_js7_joc.<hostname>.<release>.<yyyy>-<MM>-<dd>T<hh>-<mm>-<ss>.tar.gz
      • For example: backup_js7_joc.centostest_primary.2.3.1.2022-03-19T20-50-45.tar.gz
    • --log-dir
      • If a log directory is specified then the JOC Cockpit Installation Script logs information about processing steps to a log file in this directory.
      • File names are created like this: install_js7_joc.<hostname>.<yyyy>-<MM>-<dd>T<hh>-<mm>-<ss>.log
      • For example: install_js7_joc.centostest_primary.2022-03-19T20-50-45.log
    • --exec-start--exec-stop
      • This option can be used should JOC Cockpit be stopped before started after installation. For example, when using systemd then the option --exec-stopstart="StopServiceStartService" will stop start the JOC Cockpit service provided that the related systemd service has been created manually or by use of the --make-service switch. Alternatively users can specify individual commands, for example --exec-stopstart="sudo systemctl stop start js7_joc".
      • For systemd service files see the the JS7 - systemd Service Files for automated Startup and Shutdown with Unix Systems article article.
      • This option is an alternative to for use of the -restart switch that stops starts the JOC Cockpit from its Start Script. If specified this option overrules the --restart switch.
    • --returnexec-valuesstop
      • This option can be used should JOC Cockpit be stopped before installation. For example, when using systemd then the option --exec-stop="StopService" will stop the JOC Cockpit service provided that the related systemd service has been created manually or by use of the --make-service switch. Alternatively users can specify individual commands, for example --exec-stop="sudo systemctl stop js7_joc".
      • For systemd service files see the JS7 - systemd Service Files for automated Startup and Shutdown with Unix Systems article.
      • This option is an alternative to use of the -restart switch that stops the JOC Cockpit from its Start Script. If specified this option overrules the --restart switch.
    • --return-values
      • Optionally specifies the path to a file which return values will be added to in the format <name>=<key>. For example:
        • log_file=install_js7_joc.centostest_primary.2022-03-
      • Optionally specifies the path to a file which return values will be added to in the format <name>=<key>. For example:
        • log_file=install_js7_joc.centostest_primary.2022-03-20T04-54-31.log
        • backup_file=backup_js7_joc.centostest_primary.2.3.1.2022-03-20T04-54-31.tar.gz
      • An existing file will be overwritten. It is recommended that a unique file name such as /tmp/return.$$.$RANDOM.properties is used.
      • A value from the file can be retrieved like this:
        • backup=$(cat /tmp/return.$$.$RANDOM.properties | grep "backup_file" | cut -d'=' -f2)

...

  • -h | --help
    • Displays usage.
  • --noforce-configsudo
    • Specifies that no configuration changes should be applied sudo is used when performing operations on directories. This switch is required if the home or data directory is not owned by the user account running the JOC Cockpit Installation Script.
  • --no-config
    • Specifies that no configuration changes should be applied. This switch can be used for example if JOC Cockpit can be used for example if JOC Cockpit should be started or stopped only, using the --restart or --exec-start, --exec-stop options.
  • --no-install
    • Specifies if the Installation Script should be used to update configuration items without changes to the binary files of the installation.
      In fact no installation is performed but configuration changes as for example specified with the --keystore option will be applied.
  • --uninstall
    • Uninstalls the JOC Cockpit including the steps to stop & remove a running JOC Cockpit systemd service and to remove the <home> and <data> directories.
  • -u | --as-user
  • -E | --preserve-env
    • When installing for the current user account using the -u switch then environment variables are preserved when switching to the root account using sudo -E. This switch corresponds to use of ./setup.sh -u -E joc_install.xml.
  • --no-jetty
    • Skips installing the Jetty Servlet Container. This option can be used if users wish to operate JOC Cockpit from a different Servlet Container such as Tomcat.
  • --show-logs
    • Displays the log output created by the script if the --log-dir option is used.
  • --make-dirs
    • If directories are missing that are indicated with the --home, --backup-dir or --log-dir options then they will be created.
  • --make-service
    • Specifies that a systemd service should be created for JOC Cockpit. The service will be created from the --service-name option or its default value.
  • --restart
    • Stops a running JOC Cockpit before installation and starts the JOC Cockpit after installation using the JOC Cockpit's Start Script. This switch can be used with the --kill switch to control the way how JOC Cockpit is terminated. This switch is ignored if the --exec-start and --exec-stop options are used.
  • --kill
    • Kills a running JOC Cockpit if used with the --restart switch.

...

    • 1: argument errors
    • 2: non-recoverable errors
    • 3: this exit code is returned when used with the --restart switch and if it cannot be identified if a JOC Cockpit instance is running
    • 4: this exit code is returned if no --tarball option is used and download of the tarball reports errors
    • 5: this exit code is returned when used with the --restart switch and if the JOC Cockpit instance cannot be started
    • 6: this exit code is returned when used with the --restart switch and if the JOC Cockpit instance cannot be stopped
    • 7: this exit code indicates that the JOC Cockpit systemd service could not be started or stopped when using the --exec-start="StartService" or --exec-stop="StopService" options.
    • 8: this exit code indicates that the JOC Cockpit installation has failed
    • 9: this exit code indicates failure of the JOC Cockpit installation from logs

Replacements

The JOC Cockpit Installation Script performs replacements of settings in configuration files by option values, for details see chapter Replacements.

Examples

The following examples represent typical use cases. Users should consider to specify current releases, see JS7 - Download.

Install or Update from Download using individual Database

Code Block
languagebash
titleExample for use of JOC Cockpit Installation Script
./js7_install_joc.sh \
    --release=2.5.2 \
    --home=/opt/sos-berlin.com/js7/joc \
    --data=/var/sos-berlin.com/js7/joc \
    --http-port=4446 \
    --dbms-config=/home/sos/joc-deployment/hibernate.cfg.xml \
    --java-home="/opt/java/jdk-11.0.2+9" \
    --as-user \
    --make-dirs

# installs JOC Cockpit for the current user account
# requires that the user creates a hibernate.cfg.xml file for database access prior to installation
# specifies the Java home location
# downloads the JOC Cockpit release tarball from the SOS Web Site
# creates the home and data directories if they do not exist
# extracts the tarball and runs the JOC

...

Replacements

The JOC Cockpit Installation Script performs replacements of settings in configuration files by option values, for details see chapter Replacements.

Examples

...

 Cockpit installer
# operates JOC Cockpit for HTTP port 4446

Note:

Install or Update from Download using

...

embedded Database

Code Block
languagebash
titleExample for use of JOC Cockpit Installation Script
bash
titleExample for use of JOC Cockpit Installation Script
curl 'https://repo1.maven.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar' \
    -o /tmp/h2-1.4.200.jar

./js7_install_joc.sh \
    --release=2.5.2 \
    --home=/opt/sos-berlin.com/js7/joc \
    --data=/var/sos-berlin.com/js7/joc \
    --http-port=4446 \
    --dbms-configdriver=/hometmp/sos/joc-deployment/hibernate.cfg.xmlh2-1.4.200.jar \
    --dbms-config=H2 \
    --java-home="/opt/java/jdk-11.0.2+9" \ 
    --as-user \
      --make-dirs

# downloads the installsH2 JOCembedded Cockpitdatabase forfrom theMaven currentCentral userusing accountcurl
# requires thatdownloads the userJOC createsCockpit a hibernate.cfg.xml file for database access prior to installationrelease tarball from the SOS Web Site
# specifies the Java home location
# downloads built-in H2 configuration to be used and the location of the JOCJDBC CockpitDriver release tarball from.jar file
# specifies the SOSJava Webhome Sitelocation
# creates the home and data directories if they do not exist
# extracts the tarball and runs the JOC Cockpit installer
# operates JOC Cockpit for HTTP port 4446

Note:

Install or Update from

...

Tarball using

...

individual database

Code Block
languagebash
titleExample for use of JOC Cockpit Installation Script
curl 'https://repo1download.maven.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jarsos-berlin.com/JobScheduler.2.5/js7_joc_linux.2.5.2.tar.gz' \
    -o /tmp/h2-1.4.200.jarjs7_joc_linux.2.5.2.tar.gz

./js7_install_joc.sh \
    --release=tarball=/tmp/js7_joc_linux.2.5.2.tar.gz \
    --home=/opt/sos-berlin.com/js7/joc \
    --data=/var/sos-berlin.com/js7/joc \
    --http-port=4446 \
    --dbms-driver=/tmp/h2-1.4.200.jar \
    --dbms-config=H2/home/sos/joc-deployment/hibernate.cfg.xml \
    --java-home="/opt/java/jdk-11.0.2+9" \ 
    --as-user \
      --make-dirs

# downloads the H2 embedded database from Maven Central using curl
# downloads the JOC Cockpit release tarball from the SOS Web Site
# specifies the built-in H2 configuration to be used and the location of the JDBC Driver .jar fileusing curl
# specifies the Java home location
# creates the home and data directories if they do not exist
# extracts the tarball and runs the JOC Cockpit installer
# operates JOC Cockpit for HTTP port 4446

Install or Update

...

owning Home and Data Directories to separate Accounts

Code Block
languagebash
titleExample for use of JOC Cockpit Installation Script
curl 'https://download../js7_install_joc.sh \
    --release=2.5.2 \
    --home=/opt/sos-berlin.com/JobScheduler.2.5/js7_joc_linux.2.5.2.tar.gz'/js7/joc \
    --data=/var/sos-berlin.com/js7/joc \
    --o /tmp/js7_joc_linux.2.5.2.tar.gz

./js7_install_joc.shuser=sos2 \
    --home-owner=sos1:sos1 \
    --data-owner=sos2:sos2 \
    --http-port=4446 \
    --dbms-tarballconfig=/home/tmpsos/js7_joc_linux.2.5.2.tar.gzjoc-deployment/hibernate.cfg.xml \
    --java-home="/opt/java/sosjdk-berlin.com/js7/joc11.0.2+9" \
    --data=/var/sos-berlin.com/js7/jocas-user \
     --httpforce-port=4446sudo \
    --dbms-config=/home/sos/joc-deployment/make-dirs

# users can use the same home and data directory to store configuration data and log data
# installs JOC Cockpit for the current user account
# requires that the user creates a hibernate.cfg.xml \
file for database  --java-home="/opt/java/jdk-11.0.2+9" \
    --as-user \
    --make-dirs

access prior to installation
# specifies the Java home location
# downloads the JOC Cockpit release tarball from the SOS Web Site using curl
# specifies the Java home location
# creates the home and data directories if they do not exist
# extracts the tarball and runs the JOC Cockpit installer
# owns the home and data directories to separate user accounts and groups
# specifies the 'sos2' run-time account with write access to the data directory
# operates JOC Cockpit for HTTP port 4446

...