Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Introduction
The Agent Batch /Update solution comes with a job chain in JobScheduler and the job AgentBatchInstaller.
The Job AgentBatchInstaller reads a xml configuration file and creates orders for the installation job chain to setup/update agents. For each agent there is an entry in the configuration file.
The Parameters for the job chain steps will be set by the job AgentBatchInstaller while reading the xml input file.
Installer solution is available for the installation and update of the JobScheduler Universal Agent. It allows installation of any number of Agents on multiple servers across a range of environments.
Article Scope
A general description of the installation of the JobScheduler Universal Agent can be found in the JobScheduler Universal Agent - Installation & Operation article.
In addition, a number of "How to ..." articles are available describing the use of the Batch Installer in different environments. These are linked from the JobScheduler Universal Agent - Batch Installation and Update of Agents article.
This article contains reference information for users seeking more detailed information than provided in the batch installation in different environments articles.
Feature Availability
Display feature availability | ||
---|---|---|
|
The JobScheduler Universal Agent Batch Installer is available starting starting from release 1.10.2. with
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
Universal Agent Batch Installer
...
The job chain for update/installation of one Agent has the nodes:
CheckPreRequisite
- Checking for the correct java version >= 1.8
- Checking whether JobScheduler Universal Agent already has been installed.
- If so
- Shutting down a probably running instance
- remove the installation
- If so
TransferInstallaionSetup
: To transfer the setup jar file to the host- Before the transfer starts, the preprocessor will create the instancescript.sh from the template jobscheduler_agent_instance_script.txt
The files, that will be transerfered are specified in globals/transfer/file_spec=.*\.(sh|gz)$
- With this regular expression, these files will be transfered
- The JobScheduler Universal Agent: jobscheduler_unix_universal_agent.1.11.0-SNAPSHOT.tar.gz
- The instancescript: jobscheduler_agent_<port>.sh
- The installation scipt: jobscheduler_universal_agent_install.sh
PerformInstall
: To start the installation using SSH.- The in the step before transfered installation script will be executed
- The installation script will install and start the JobScheduler Universal Agent
- Finally the postprocessing commands will be executed
- The postprocessing commands are stored in installation/postprocessing/command
- Three commands will be executed
- if you have more than three commands, please add the call in the job PerformInstall
- The default commands will setup the autostart for JobScheduler Universal Agent on an Ubuntu server
- echo ${ssh.sudo_password} | sudo -S cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler
- echo ${ssh.sudo_password} | sudo -S update-rc.d jobscheduler defaults
Parameters
All jobs have access to the following parameters. These parameters also will be used for the JobScheduler Universal Agent instance script to the options for the start.
Parameter | Description | XML |
---|---|---|
agent_options.scheduler_ip_address | The ip address of the JobScheduler Universal Agents host | installation/agent_options/scheduler_ip_address |
agent_options.scheduler_http_port | The port of the JobScheduler Universal Agent | installation/agent_options/scheduler_http_port |
agent_options.java_home | installation/agent_options/java_home | |
agent_options.java_options | installation/agent_options/java_options | |
agent_options.scheduler_home | If SCHEDULER_HOME is not set, the default will be set. Default: install_path + "/jobscheduler_agent" | installation/agent_options/scheduler_home |
agent_options.scheduler_user | installation/agent_options/scheduler_user | |
agent_options.scheduler_log_dir | installation/agent_options/scheduler_log_dir | |
agent_options.scheduler_kill_script | installation/agent_options/scheduler_kill_script | |
agent_options.scheduler_pid_file_dir | installation/agent_options/scheduler_pid_file_dir | |
host | The ssh ip address of the JobScheduler Universal Agents host | installation/ssh/host |
port | The ssh port of the JobScheduler Universal Agent | installation/ssh/port |
user | The ssh user of the JobScheduler Universal Agent | installation/ssh/user |
auth_method | The ssh auth method of the JobScheduler Universal Agent | installation/ssh/auth_method |
auth_file | The ssh auth file of the JobScheduler Universal Agent | installation/ssh/auth_file |
password | The ssh password of the JobScheduler Universal Agent | installation/ssh/password |
sudo_password | The sudo password for ssh user | installation/ssh/sudo_password |
install_path | The folder, where JobScheduler Universal Agent will be installed | installation/install_path |
TransferInstallationSetup
For more detailed explanation of the parameters have a look at the yade documentaiton.
Please note that it is recommended only to specify the settings file in the globals entry and use the default profile name <host>:<port>. Then the entry installation/transfer is not neccessary in the installation input file
settings | The file with the profiles, one for each JobSchedule Universal Agent | installation/transfert/settings |
profile | The name of the profile for the actual installation. Default=<host>:<port> | installation/transfer/profile |
file_spec | a regular expression that defines the set of files that should be transfered | installation/transfer/file_spec |
target_host | the host to which the files should be transfered | installation/transfer/target/host |
target_port | the port according to the given protocol (e.g. 21 when protocol is ftp) | installation/transfer/target/port |
target_protocol | the protocol with wich the target will be transered (ftp, sftp, file, local) | installation/transfer/target/protocol |
target_user | the user (if the protocol needs one) with wich the target will be transered | installation/transfer/target/user |
target_password | the password (if the protocol needs one) with wich the target will be transered | installation/transfer/target/password |
target_dir | the location where the files will be copied to | installation/transfer/target/dir |
target_ssh_auth_method | the authentication method if the protocol is ssh. | installation/transfer/target/auth_method |
target_ssh_auth_file | the authentication file if the protocol is ssh and auth_method is publickey | installation/transfer/target/auth_file |
source_host | the host from where the files should be transfered | installation/transfer/source/host |
source_port | the port according to the given protocol (e.g. 21 when protocol is ftp) | installation/transfer/source/port |
source | the protocol with wich the source will be transered (ftp, sftp, file, local) | installation/transfer/source/protocol |
source_user | the user (if the protocol needs one) with wich the source will be transered | installation/transfer/source/user |
source_password | the password (if the protocol needs one) with wich the source will be transered | installation/transfer/source/password |
source_dir | the location from where the files will be copied | installation/transfer/source/dir |
source_ssh_auth_method | the authentication method if the protocol is ssh. | installation/transfer/source/auth_method |
source_ssh_auth_file | the authentication file if the protocol is ssh and auth_method is publickey | installation/transfer/source/auth_file |
PerformInstall
For more detailed explanation of the parameters have a look at the jitl ssh job documentaiton
Parameter | Description | XML |
---|---|---|
command_n | n = 0... The commands for the postprocessing. E.g. enabling the autostart of the Universal Agent | installation/postprocessing/command |
command_counter | The number of given command |
Starting the update/installation
The update/installation procedure will be started by running the job AgentBatchInstaller.
The job AgentBatchInstaller
The job AgentBatchInstaller reads the input file and creates orders for each element <installation>
The element <installation> defines the source and the target of the installation files, the port for the JobScheduler Universal Agent and the ssh connection parameters. Please note
- For all elements you can define defaults in the globals section
- You can use variables for the values e.g. ${ssh.host}
- It is recommended to specify the filename of the YADE settings in the globals element and use the default profile name. When doing this, no installation/transfer elements are needed
Parameters
Parameter | Description | Example |
---|---|---|
installation_definition_file | The xml file that contains all parameters for the batch installation | c:\batch\batchinstall.xml |
filter_install_host | A host name if only one order should be created that matches the given host | myAgent |
filter_install_port | A port if only one order should be created that matches the given host | 4445 |
installation_job_chain | The name of the job chain for which the orders should be created | /batch_install_universal_agent/universal_agent_installer |
update | If true an order for all <instances> will be created. If false an order for <instances> that do not have the last_run attribute will be created | true |
Customizing the installation process
You can customize the installation process.
- Changing the script part in the ssh jobs CheckPreRequisite and PerformInstall e.g. if you want to check other prerequisites or execute some commands before or after the installation.
- Changing the installation script jobscheduler_universal_agent_install.sh
- Changing the template for instance start script jobscheduler_agent_instance_script.txt
Checking Prerequisites
The job CheckPreRequisite checks the java version, shutdown a probably running JobScheduler Universal Agent and removes the lib folder from the old installation.
Code Block | ||||
---|---|---|---|---|
| ||||
echo .JobScheduler Universal Agent
echo .checking prerequisites ${install_path}
echo .checking Java Runtime Version >= 1.8? ......
JAVA_VER=$(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
if [ "$JAVA_VER" > "18" ]
then
echo ..java version: $JAVA_VER ok
else
echo ..wrong Java version found
echo ..expectet version is >= 1.8
echo ..installed version is $JAVA_VER
exit 8
fi
echo .checking whether JobScheduler Universal Agent is already installed?
if [ -f ${install_path}/jobscheduler_agent/bin/jobscheduler_agent.sh ]
then
echo ..JobScheduler Universal Agent already installed
echo ..shutting down JobScheduler Universal Agent
${install_path}/jobscheduler_agent/bin/jobscheduler_agent.sh stop
echo ..removing installation from ${install_path}
rm -Rf ${install_path}/lib
else
echo .. this is the first installation of JobScheduler Universal Agent
fi
exit $? |
PerformInstall
The job PerformInstall calls the installation script and executes the commands given in the <postprocessing> element.
Code Block | ||||
---|---|---|---|---|
| ||||
echo Executing PerformInstall ${target_dir}
chmod a+x ${target_dir}/jobscheduler_universal_agent_install.sh
${target_dir}/jobscheduler_universal_agent_install.sh -d${install_path} -p${agent_options.scheduler_http_port}
${command_0}
${command_1}
${command_2} |
The installation script
The installation script unzip the installation file and starts the JobScheduler Universal Agent
Components
The Batch Installer is operated by a JobScheduler Master that:
- connects to the Servers that the Agents are to be installed on and
- executes the required Agent installations.
The Batch Installer application has two main components:
- a JobScheduler
AgentBatchInstaller
job and - a JobScheduler
universal_agent_installer
job chain.
In addition, two XML files are needed for the application:
batch_installer_config_file.xml
andyade_agent_batch_installer_settings.xml
The AgentBatchInstaller
job is responsible for creating the JobScheduler orders for the job chain. Each of these orders is named according to the pattern <host>:<port>
to convey the host and port of the server where each Agent is to be installed.
The Universal Agent Batch Installer Job Chain
The universal_agent_installer
job chain has four job nodes configured in series as shown in the code block and diagram below:
Job Chain: universal_agent_installer.job_chain.xml
Code Block | ||||
---|---|---|---|---|
| ||||
<job_chain name="universal_agent_installer">
<job_chain_node state="CheckPreRequisite" job="CheckPreRequisite" next_state="Sync" error_state="error"/>
<job_chain_node state="Sync" job="Sync" next_state="TransferInstallationSetup" error_state="error"/>
<job_chain_node state="TransferInstallationSetup" job="TransferInstallationSetup" next_state="PerformInstall" error_state="error"/>
<job_chain_node state="PerformInstall" job="PerformInstall" next_state="success" error_state="error" on_error="suspend"/>
<job_chain_node state="success"/>
<job_chain_node state="error"/>
</job_chain> |
The individual nodes in the job chain have the following functions:
CheckPreRequisite
- Check for the correct Java version
- Check whether a JobScheduler Universal Agent already has been installed.
- If yes, then the Installer:
- shuts down any instances that are possibly running
- removes the installation
- If yes, then the Installer:
Sync:
Wait until all prerequisites have been checked and all instances shut down.TransferInstallationSetup
: Transfer the installer files to the host- Before the transfer starts, the preprocessor will create the instance start script from the template
jobscheduler_agent_instance_script.txt
The files that are to be transfered are specified with the <globals><transfer><file_spec=".*\.(sh|gz)$"> configuration element
- This regular expression causes the following files to be transfered:
- the JobScheduler Universal Agent installer files:
jobscheduler_unix_universal_agent.<version>.tar.gz
- the instance start script:
jobscheduler_agent_<port>.sh
- the installation script:
jobscheduler_universal_agent_install.sh
- the JobScheduler Universal Agent installer files:
- This regular expression causes the following files to be transfered:
- Before the transfer starts, the preprocessor will create the instance start script from the template
PerformInstall
: Start the installation using SSH.- The step before transfered installation script will be executed
- The installation script installs and starts the JobScheduler Universal Agent
- Finally the post-processing commands will be executed
- The post-processing commands are specified with the
<installation><postprocessing><command> element
- Three commands will be executed
- if you require additional commands, please add the call in the
PerformInstall
job
- if you require additional commands, please add the call in the
- The default commands set up the autostart for JobScheduler Universal Agent on a Linux server (Ubuntu distribution)
echo ${ssh.sudo_password} | sudo -S cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler
echo ${ssh.sudo_password} | sudo -S update-rc.d jobscheduler defaults
- The post-processing commands are specified with the
Job Parameters
All jobs have access to the following parameters. These parameters are used for the JobScheduler Universal Agent instance start script.
Parameter | Description | XML |
---|---|---|
<job chain>_required_orders | The number of orders that have been created where job_chain is the value of the parameter installation_job_chain in the job AgentBatchInstaller | |
agent_options.scheduler_ip_address | The IP address of the JobScheduler Universal Agents host. If no value is specified, the value from the paramter host in the ssh section will be used. | installation/agent_options/scheduler_ip_address |
agent_options.scheduler_http_port | The port of the JobScheduler Universal Agent. Default=4445 | installation/agent_options/scheduler_http_port |
agent_options.java_home | installation/agent_options/java_home | |
agent_options.java_options | installation/agent_options/java_options | |
agent_options.scheduler_home | will be set to | Not available in XML |
agent_options.scheduler_user | installation/agent_options/scheduler_user | |
agent_options.scheduler_log_dir | installation/agent_options/scheduler_log_dir | |
agent_options.scheduler_kill_script | installation/agent_options/scheduler_kill_script | |
agent_options.scheduler_pid_file_dir | installation/agent_options/scheduler_pid_file_dir | |
host | The SSH IP address of the JobScheduler Universal Agents host | installation/ssh/host |
port | The SSH port of the JobScheduler Universal Agent | installation/ssh/port |
user | The SSH user of the JobScheduler Universal Agent | installation/ssh/user |
auth_method | The SSH authentication method of the JobScheduler Universal Agent | installation/ssh/auth_method |
auth_file | The SSH authentication file of the JobScheduler Universal Agent | installation/ssh/auth_file |
password | The password for the SSH user | installation/ssh/password |
sudo_password | The sudo password for the SSH user | installation/ssh/sudo_password |
install_path | The folder to which the JobScheduler Universal Agent will be installed | installation/install_path |
Job: TransferInstallationSetup
This job uses the YADE JITL job to transfer the installer files to the host.
More detailed explanations of the parameters are available with the YADE - Documentation.
It is recommended that the YADE settings file is specified with the <globals>
element and that the default profile name <host>:<port>
is used. The <installation><transfer>
element is not then required for the installer configuration file.
Parameter | Description | XML |
---|---|---|
settings | the file with the profiles, one for each JobScheduler Universal Agent | installation/transfer/settings |
profile | the name of the profile for the current installation. Default=<host>:<port> | installation/transfer/profile |
file_spec | a regular expression that defines the set of files that should be transfered | installation/transfer/file_spec |
target_host | the host to which the files should be transfered | installation/transfer/target/host |
target_port | the port according to the given protocol, e.g. 21 for the FTP protocol | installation/transfer/target/port |
target_protocol | the protocol with which the installation files will be transfered (FTP, SFTP, file, local) | installation/transfer/target/protocol |
target_user | the user (if required by the protocol) with which the installation files will be transfered | installation/transfer/target/user |
target_password | the password (if required by the protocol) with which the installation files will be transfered | installation/transfer/target/password |
target_dir | the location that the files will be copied to | installation/transfer/target/dir |
target_ssh_auth_method | the authentication method should the SSH protocol be used | installation/transfer/target/auth_method |
target_ssh_auth_file | the authentication file should the the SSH protocol be used and the target_ssh_auth_method parameter be used with the value publickey | installation/transfer/target/auth_file |
source_host | the host from which the installation files should be transfered | installation/transfer/source/host |
source_port | the port according to the given protocol (e.g. 21 when protocol is ftp) | installation/transfer/source/port |
source | the protocol with which the source will be transferred (ftp, sftp, file, local) | installation/transfer/source/protocol |
source_user | the user (if the protocol needs one) with which the source will be transferred | installation/transfer/source/user |
source_password | the password (if the protocol needs one) with which the source will be transferred | installation/transfer/source/password |
source_dir | the location from where the files will be copied | installation/transfer/source/dir |
source_ssh_auth_method | the authentication method if the protocol is ssh. | installation/transfer/source/auth_method |
source_ssh_auth_file | the authentication file if the protocol is ssh and auth_method is publickey | installation/transfer/source/auth_file |
Job: PerformInstall
More detailed explanations of the parameters are available with the JITL SSH job documentation
Parameter | Description | XML |
---|---|---|
command_n | n = 0... The commands for the post-processing, e.g. enabling the autostart of the Universal Agent | installation/postprocessing/command |
command_counter | The number of commands specified |
Starting the update/installation
The update/installation procedure is started by running the AgentBatchInstaller
job, which is described in the next section.
The AgentBatchInstaller
Job
The job AgentBatchInstaller
reads the installer configuration file and creates orders for each element <installation>
.
The element <installation>
defines the source and the target of the installer files, the port for the JobScheduler Universal Agent and the SSH connection parameters. Please note:
- You can define defaults for all elements in the <
globals>
element. - You can use variables for values e.g.
${ssh.host}
. - It is recommended that you specify the name of the YADE settings file in the <
globals>
element and use the default profile name as shown in the example Configuration File below. This will mean that it is not necessary to define<installation><transfer>
elements.
Parameters for the AgentBatchInstaller
Job
Parameter | Description | Example |
---|---|---|
installation_definition_file | The XML file that contains all parameters for the batch installation | c:\batch\batchinstall.xml |
filter_install_host | A host name if only one order should be created that matches the given host | myAgent |
filter_install_port | A port if only one order should be created that matches the given host |
|
installation_job_chain | The name of the job chain for which the orders should be created | /batch_install_universal_agent/universal_agent_installer |
update | If true then an order for all If false then an order for | true |
Customizing the Installation Process
The installation process can be customized as follows.
- The scripts in the
CheckPreRequisite
andPerformInstall
SSH jobs can be modified.- Use this if you want to check other prerequisites or execute additional commands either before or after the installation.
- The
jobscheduler_universal_agent_install.sh
installation script can be modified. - The template for the
jobscheduler_agent_instance_script.txt
start script for the Agent instances can be modified.
Checking Prerequisites
The CheckPreRequisite
job will check the Java version, shut down any JobScheduler Universal Agent that may be running and remove the lib
folder from an existing installation.
Code Block | ||||
---|---|---|---|---|
| ||||
echo .JobScheduler Universal Agent
echo .checking prerequisites ${install_path}
echo .checking Java Runtime Version >= 1.8? ......
JAVA_VER=$(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
if [ "$JAVA_VER" > "18" ]
then
echo ..java version: $JAVA_VER ok
else
echo ..wrong Java version found
echo ..expectet version is >= 1.8
echo ..installed version is $JAVA_VER
exit 8
fi
echo .checking whether JobScheduler Universal Agent is already installed?
if [ -f ${install_path}/jobscheduler_agent/bin/jobscheduler_agent.sh ]
then
echo ..JobScheduler Universal Agent already installed
echo ..shutting down JobScheduler Universal Agent
${install_path}/jobscheduler_agent/bin/jobscheduler_agent.sh stop
echo ..removing installation from ${install_path}
rm -Rf ${install_path}/lib
else
echo .. this is the first installation of JobScheduler Universal Agent
fi
exit $? |
Performing the Installation
The PerformInstall
job calls the installation script and executes the commands specified with the <postprocessing>
element.
Code Block | ||||
---|---|---|---|---|
| ||||
echo Executing PerformInstall ${target_dir}
echo ${sudo_passwort} | sudo -S chmod a+x ${target_dir}/jobscheduler_universal_agent_install.sh
echo ${sudo_passwort} | sudo -S ${target_dir}/jobscheduler_universal_agent_install.sh -d${install_path} -p${agent_options.scheduler_http_port}
${command_0}
${command_1}
${command_2} |
The Installation Script
The installation script will unzip the Agent installation file and start the JobScheduler Universal Agent.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#!/bin/sh
# Copyright (c) 2015 SOS GmbH, Berlin, Germany.
# All rights reserved.
export TERM=dumb
clear
echo "+----------- | ||||||
Code Block | ||||||
| ||||||
#!/bin/sh # Copyright (c) 2015 SOS GmbH, Berlin, Germany. # All rights reserved. export TERM=dumb clear echo "+---------------------------------------------------------+" echo "* JobScheduler Univeral Agent *" echo "* SOS Software- und Organisations Service GmbH *" echo "* Giesebrechtstr. 15 *" echo "* 10629 Berlin *" echo "* ---------------------------------------------- *+" echo "* info@sos-berlin.comJobScheduler Univeral Agent *" echo "* http://www.sos-berlin.com SOS Software- und Organisations Service GmbH *" echo "* Giesebrechtstr. 15 *" echo "+---------------------------------------------------------+" echo "" echo "" echo "+- *" echo "* 10629 Berlin *" echo "* --------------------------------------------------------+ *" echo "* This will installinfo@sos-berlin.com JobScheduler Universal Agent now ... *" echo "* http://www.sos-berlin.com *" echo "+---------------------------------------------------------+" echo "" # ------- echo "" echo "+---------------------------------------- cd `dirname $0` SETUP_WORKING_DIR=`pwd` SETUP_INSTALL_PATH="" SHOW_EXTRACTED_FILESNAMES=0 SETUP_LOG_FILE="$SETUP_WORKING_DIR/jobscheduler_universal_install.log" SETUP_ERR=0 # ---------------------+" echo "* This will install JobScheduler Universal Agent now ... *" echo "+----------------------------------------------- log_write() { case "$1" in 0 ) msg_hint="[info] ";; 1 ) msg_hint="[warning]";; 2 ) msg_hint="[error] ";; 3 ) msg_hint="[fatal] ";; * ) msg_hint="[info] ";; esac timestamp=`date "+%Y-%m-%d %T"` msg="$timestamp $msg_hint $2" echo "$msg" echo "$msg">>"$SETUP_LOG_FILE" } show_usage() { echo "`basename $1` will install the 'JobScheduler Universal Agent' at [install_dir]." echo "install_dir=Path with the JobScheduler Universal Agent" echo echo "Usage: `basename $1` [OPTION]" echo echo "Samples:" echo " `basename $1` -co -d/home/jobscheduler -p4445 " echo echo "Options:" echo " -h, --help | Shows this usage" echo " -s, --show | show all extracted filenames----------+" # ----------------------------------------------- cd `dirname $0` SETUP_WORKING_DIR=`pwd` SETUP_INSTALL_PATH="" SHOW_EXTRACTED_FILESNAMES=0 SETUP_LOG_FILE="$SETUP_WORKING_DIR/jobscheduler_universal_install.log" SETUP_ERR=0 # ----------------------------------------------------------------- log_write() { case "$1" in 0 ) msg_hint="[info] ";; 1 ) msg_hint="[warning]";; 2 ) msg_hint="[error] ";; 3 ) msg_hint="[fatal] ";; * ) msg_hint="[info] ";; esac timestamp=`date "+%Y-%m-%d %T"` msg="$timestamp $msg_hint $2" echo "$msg" echo "$msg">>"$SETUP_LOG_FILE" } show_usage() { echo "`basename $1` will install the 'JobScheduler Universal Agent' at [install_dir]." echo "install_dir=Path with the JobScheduler Universal Agent" echo echo "Usage: `basename $1` [OPTION]" echo echo "Samples:" echo " `basename $1` -co -d/home/jobscheduler -p4445 " echo echo "Options:" echo " -w h, --install_dirhelp | Path of the JobScheduler| UniversalShows Agentthis installationusage" echo " -p s, --portshow | show Portall ofextracted JobSchedulerfilenames" Universal Agent.echo Default=4445" } # ----------------------------------------------------------------------------usage if [ $# -eq 0 ] then show_usage $0 exit 65 fi -w --install_dir | Path of the JobScheduler Universal Agent installation" echo " -p --port | Port of JobScheduler Universal Agent. Default=4445" } # -------------------------------------------- for arg in "$@" do long_opt=0 echo "`expr match $arg '\(..\)'`" case "`expr match--------------------------------usage if [ $# -eq 0 ] then show_usage $0 exit 65 fi # -------------------------------------------- for arg in "$@" do long_opt=0 echo "`expr match $arg '\(..\)'`" in case "-h"`expr match ) show_usage $0; exit 64;; "-d" ) SETUP_INSTALL_PATH="`expr match $arg '-d\(.*\)'`";; "-p" ) UNIVERSAL_AGENT_PORT="`expr match $arg '-p\(.*\)'`";; "-s" ) SHOW_EXTRACTED_FILESNAMES="`expr match $arg '-d\(.*\)'`";; "--" ) long_opt=1;; esac if [ "$long_opt" -eq 1 ] then case `expr match "$arg" '\(--[^=]*\)'` in "--show_extracted_filenames" ) SHOW_EXTRACTED_FILESNAMES=`expr match "$arg" '--.*=\(.*\)'`;; "--help" ) show_usage $0; exit 64;; "--install_dir" ) SETUP_INSTALL_PATH=`expr match "$arg" '--.*=\(.*\)'`;; "--port" ) UNIVERSAL_AGENT_PORT=`expr match "$arg" '--.*=\(.*\)'`;; esac fi done # --------------- check_dir(){ SETUP_INSTALL_PATH="$1" echo SETUP_INSTALL_PATH="$SETUP_INSTALL_PATH" if [ -d "$SETUP_INSTALL_PATH" ] then if [ -r "$SETUP_INSTALL_PATH" ] then cd "$SETUP_INSTALL_PATH" SETUP_INSTALL_PATH=`pwd` chmod 700 "$SETUP_INSTALL_PATH" 2>/dev/null SETUP_ERR=$? else log_write 2 "$SETUP_INSTALL_PATH is not readable." SETUP_ERR=1 fi else echo create $SETUP_INSTALL_PATH mkdir -m700 -p "$SETUP_INSTALL_PATH" 2>/dev/null SETUP_ERR=$? if [ $SETUP_ERR -eq 0 ] then cd "$SETUP_INSTALL_PATH" SETUP_INSTALL_PATH=`pwd` else log_write 2 "$SETUP_INSTALL_PATH can not create." SETUP_ERR=1 fi fi cd "$SETUP_WORKING_DIR" if [ $SETUP_ERR -ne 0 ] then log_write 2 "You haven't the necessary rights on the installation directory $SETUP_INSTALL_PATH." exit $SETUP_ERR fi } tarx (){ if [ -f "$1.gz" ] then gzip -fd $1.gz fi if [ ! -d "$2" ] then mkdir $2 fi cd $2 tar $tarpar $SETUP_WORKING_DIR/$1 cd $SETUP_WORKING_DIR } tarpar="-xf " if [ "$SHOW_EXTRACTED_FILESNAMES" = "1" ] then tarpar="-xvf " fi SETUP_INSTALL_PATH="$SETUP_INSTALL_PATH" echo SETUP_INSTALL_PATH=$SETUP_INSTALL_PATH check_dir $SETUP_INSTALL_PATH # Installing log_write 0 "Installing --> $SETUP_INSTALL_PATH" tarx jobscheduler_unix_universal_agent.1.11.0-SNAPSHOT.tar $SETUP_INSTALL_PATH if [ -z "$UNIVERSAL_AGENT_PORT" ] then $UNIVERSAL_AGENT_PORT=4445 fi mv `dirname $0`/jobscheduler_agent_$UNIVERSAL_AGENT_PORT.sh $SETUP_INSTALL_PATH/jobscheduler_agent/bin chmod a+x $SETUP_INSTALL_PATH/jobscheduler_agent/bin/jobscheduler_agent_$UNIVERSAL_AGENT_PORT.sh log_write 0 "Start JobScheduler Universal Agent" log_write 0 $SETUP_INSTALL_PATH/jobscheduler_agent/bin/jobscheduler_agent_$UNIVERSAL_AGENT_PORT.sh start $SETUP_INSTALL_PATH/jobscheduler_agent/bin/jobscheduler_agent_$UNIVERSAL_AGENT_PORT.sh start 1 > /dev/null exit $? |
The installation input File
The installation input file contains a <installation> element for each JobScheduler Universal Agent instance.
The minimum Example for the xml configuration file:
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="utf-8"?>
<installations lastRun="2015-11-06 15:11">
<globals>
<transfer>
<settings><![CDATA[C:\Temp\batch_install\yade_agent_batch_installer_settings.ini]]></settings>
</transfer>
</globals>
<installation lastRun="2015-11-06 15:11">
<install_path><![CDATA[/home/test/temp/xxx]]></install_path>
<agent_options>
<scheduler_http_port>4445</scheduler_http_port>
<scheduler_ip_address><![CDATA[192.11.0.116]]></scheduler_ip_address>
</agent_options>
<ssh>
<user><![CDATA[test]]></user>
<password><![CDATA[12345]]></password>
<sudo_password><![CDATA[12345]]></sudo_password>
<auth_method><![CDATA[password]]></auth_method>
<port><![CDATA[22]]></port>
</ssh>
<postprocessing>
<command><![CDATA[echo ${ssh.sudo_password} | sudo cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler]]></command>
<command><![CDATA[echo ${ssh.sudo_password} | sudo update-rc.d jobscheduler defaults]]></command>
</postprocessing>
</installation>
</installations> |
In the global entry, you specify the values which are used for all installation items. The installation items can overwrite these values. There is one installation item for each agent. You can make use of substitution in the values of the entries.
Code Block | ||
---|---|---|
| ||
<command>echo ${ssh.sudo_password} | sudo cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler</command>
|
Using the XML Editor
Then XML Editor can be used to manage the installation input file. It is also used th manage the YADE profiles for the transfer of the installation file
The XML Editor is available here: http://www.sos-berlin.com/xml-editor-downloads
After downloading the file, extrac the zip file. Then start "sos.xml.editor.exe"
Open your installtion input file an assign the schema scheduler_universal_agent_installations.xsd
Managing the YADE profiles for the file transfer
Each installation has a profile in the YADE settings file. The default profile name is <host>:<port> where <host> will be substituted with the value in installation/agent_option/scheduler_ip_address and <port> will be substituted with the value in installation/agent_option/scheduler_http_port.
- Please specify the name of the YADE settings file in globals/settings.
- Open the YADE settings file (or create a new one).
- Assign the schema http://www.sos-berlin.com/schema/yade/YADE_configuration_v1.0.xsd
- Add <ProtocolFragments> for each host you want install JobScheduler Universal Agent
- Add <Profile> for each host you want install JobScheduler Universal Agent.
- The default for the profile_id is <host>:<port> If you do not use the default, you have to specify the profile name in the installations input file.
Installation of the Batch Installer for the JobScheduler Universal Agent
Unzip the JobScheduler Universal Agent Batch Installer zip file.
- copy the content of the live folder to the live folder of a JobScheduler instance
- copy the content of the folder batch_install to any folder
- create an installation input file
- adjust the parameter values for the job AgentBatchInstaller
- set the name for settings file in the installation input file (globals/transfer/settings)
- create the YADE settings file
- Add <ProtocolFragments> for each host you want install JobScheduler Universal Agent
- Add a <Profile> for each host you want install JobScheduler Universal Agent.
Files
The Zip file for the JobScheduler Universal Agent batch installer contains
Folder batch_install_universal_agent
Folder batch_install_universal_agent contains the configuration files for the job chain and jobs that will provide the batch installer for the JobScheduler Universal Agent
AgentBatchInstaller.job.xml
Contains the configuration for the batch installer starter job. The job will read the batch installation file that contains an entry for each Agent and create an order for the batch installer job chain for each Agent that should be installed/updated
Code Block | ||||
---|---|---|---|---|
| ||||
<job name="BatchInstaller">
<params >
<param name="installation_definition_file" value="c:\temp\batchinstall.xml"/>
<param name="filter_install_host" value=""/>
<param name="filter_install_port" value=""/>
<param name="installation_job_chain" value="/batch_install_universal_agent/universal_agent_installer"/>
<param name="update" value="true"/>
</params>
<script language="java" java_class_path="" java_class="com.sos.jitl.agentbatchinstaller.JSUniversalAgentBatchInstallerJSAdapterClass"/>
<run_time />
</job> |
CheckPreRequisite.job.xml
Contains the configuration for the job that checks the prerequisites.
The job is implemented by the JITL SSH job. The script that will be exexuted to check the prerequisites is defined in the script tag of the job.
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="ISO-8859-1"?>
<job title="Launch remote commands or executable files by SSH" order="yes" stop_on_error="no">
<description >
<include file="jobs/JobSchedulerSSHJob.xml"/>
</description>
<params />
<script language="java" java_class="sos.scheduler.job.SOSSSHJob2JSAdapter">
<![CDATA[
echo .JobScheduler Universal Agent
echo .checking prerequisites ${install_path}
echo .checking Java Runtime Version >= 1.8? ......
JAVA_VER=$(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
if [ "$JAVA_VER" > "18" ]
then
echo ..java version: $JAVA_VER ok
else
echo ..wrong Java version found
echo ..expectet version is >= 1.8
echo ..installed version is $JAVA_VER
exit 8
fi
echo .checking whether JobScheduler Universal Agent is already installed?
if [ -f ${install_path}/jobscheduler_agent/bin/jobscheduler_agent.sh ]
then
echo ..JobScheduler Universal Agent already installed
echo ..shutting down JobScheduler Universal Agent
${install_path}/jobscheduler_agent/bin/jobscheduler_agent.sh stop
echo ..removing installation from ${install_path}
rm -Rf ${install_path}/lib
else
echo .. this is the first installation of JobScheduler Universal Agent
fi
exit $?
]]>
</script>
<run_time />
</job> |
TransferInstallationSetup.job.xml
Contains the configuration for the job that transfers the installation files.
The job is implemented by the JITL YADE job.
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="ISO-8859-1"?>
<job title="API Job for JobScheduler Advanced Data Exchange" order="yes" stop_on_error="no">
<description >
<include file="jobs/jadeJob.xml"/>
</description>
<environment >
<variable name="test" value="1"/>
</environment>
<script language="java" java_class="sos.scheduler.jade.JadeJob"/>
<run_time />
</job> |
PerformInstall.job.xml
Contains the configuration for the job that executes the installation of the JobScheduler Universal Agent
The job is implemented by the JITL ssh job.
Code Block | ||||
---|---|---|---|---|
| ||||
<job title="Launch remote commands or executable files by SSH" order="yes" stop_on_error="no" name="PerformInstall">
<description >
<include file="jobs/JobSchedulerSSHJob.xml"/>
</description>
<params />
<script language="java" java_class="sos.scheduler.job.SOSSSHJob2JSAdapter">
<![CDATA[
echo Executing PerformInstall ${target_dir}
chmod a+x ${target_dir}/jobscheduler_universal_agent_install.sh
${target_dir}/jobscheduler_universal_agent_install.sh -d${install_path}
test -z "${command_1}" || "${command_1}"
rc=$?
test $rc -eq 0 && test -z "${command_2}" || "${command_2}"
rc=$?
test $rc -eq 0 && test -z "${command_3}" || "${command_3}"
exit $?
]]>
</script>
<monitor name="templateProcessor" ordering="1">
<script language="java:javascript">
<![CDATA[
function spooler_process_before(){
var order = spooler_task.order;
var source_dir = order.params.value("PerformInstall/source_dir");
var scheduler_http_port = order.params.value("scheduler_http_port");
var templateProcessor = new Packages.com.sos.jitl.agentbatchinstaller.JSUniversalAgentBatchInstallerProcessTemplate();
templateProcessor.execute(source_dir+"/jobscheduler_agent_instance_script.txt",source_dir+"/jobscheduler_agent_" + scheduler_http_port + ".sh",spooler_task.order.delegate);
return true;
}
]]>
</script>
</monitor>
<run_time />
</job>
|
installation_definition_file
Code Block |
---|
<?xml version="1.0" encoding="ISO-8859-1"?>
<job >
<params >
<param name="installation_definition_file" value="c:\temp\batchinstall.xml"/>
<param name="filter_install_host" value=""/>
<param name="filter_install_port" value=""/>
<param name="installation_job_chain" value="/batch_install_universal_agent/universal_agent_installer"/>
<param name="update" value="true"/>
</params>
<script language="java" java_class_path="" java_class="com.sos.jitl.agentbatchinstaller.JSUniversalAgentBatchInstallerJSAdapterClass"/>
<run_time />
</job> |
PerformInstall.job.xml
Contains the configuration for the job that executes the installation.
The job is implemented by the JITL SSH job. The script that will be exexuted to check the prerequisites is defined in the script tag of the job. The order has the following parameters for this step.
installation_definition_file
Code Block |
---|
<?xml version="1.0" encoding="ISO-8859-1"?>
<job >
<params >
<param name="installation_definition_file" value="c:\temp\batchinstall.xml"/>
<param name="filter_install_host" value=""/>
<param name="filter_install_port" value=""/>
<param name="installation_job_chain" value="/batch_install_universal_agent/universal_agent_installer"/>01
<param name="update" value="true"/>
</params>
<script language="java" java_class_path="" java_class="com.sos.jitl.agentbatchinstaller.JSUniversalAgentBatchInstallerJSAdapterClass"/>
<run_time />
</job> |
Folder setup
The folder setup contains the files that will be transfered to the Agents server during the installation process
Installation script
Template for the instance script
The JobScheduler Universal Agent
Job Chain
Job Batch Installer
XSD for installation input file
You will find the xsd-schema for the configuration in config/scheduler_universal_agent_installations.xsd
$arg '\(..\)'`" in
"-h" ) show_usage $0; exit 64;;
"-d" ) SETUP_INSTALL_PATH="`expr match $arg '-d\(.*\)'`";;
"-p" ) UNIVERSAL_AGENT_PORT="`expr match $arg '-p\(.*\)'`";;
"-s" ) SHOW_EXTRACTED_FILESNAMES="`expr match $arg '-d\(.*\)'`";;
"--" ) long_opt=1;;
esac
if [ "$long_opt" -eq 1 ]
then
case `expr match "$arg" '\(--[^=]*\)'` in
"--show_extracted_filenames" ) SHOW_EXTRACTED_FILESNAMES=`expr match "$arg" '--.*=\(.*\)'`;;
"--help" ) show_usage $0; exit 64;;
"--install_dir" ) SETUP_INSTALL_PATH=`expr match "$arg" '--.*=\(.*\)'`;;
"--port" ) UNIVERSAL_AGENT_PORT=`expr match "$arg" '--.*=\(.*\)'`;;
esac
fi
done
# ---------------
check_dir(){
SETUP_INSTALL_PATH="$1"
echo SETUP_INSTALL_PATH="$SETUP_INSTALL_PATH"
if [ -d "$SETUP_INSTALL_PATH" ]
then
if [ -r "$SETUP_INSTALL_PATH" ]
then
cd "$SETUP_INSTALL_PATH"
SETUP_INSTALL_PATH=`pwd`
chmod 700 "$SETUP_INSTALL_PATH" 2>/dev/null
SETUP_ERR=$?
else
log_write 2 "$SETUP_INSTALL_PATH is not readable."
SETUP_ERR=1
fi
else
echo create $SETUP_INSTALL_PATH
mkdir -m700 -p "$SETUP_INSTALL_PATH" 2>/dev/null
SETUP_ERR=$?
if [ $SETUP_ERR -eq 0 ]
then
cd "$SETUP_INSTALL_PATH"
SETUP_INSTALL_PATH=`pwd`
else
log_write 2 "$SETUP_INSTALL_PATH can not create."
SETUP_ERR=1
fi
fi
cd "$SETUP_WORKING_DIR"
if [ $SETUP_ERR -ne 0 ]
then
log_write 2 "You haven't the necessary rights on the installation directory $SETUP_INSTALL_PATH."
exit $SETUP_ERR
fi
}
tarx (){
if [ -f "$1.gz" ]
then
gzip -fd $1.gz
fi
if [ ! -d "$2" ]
then
mkdir $2
fi
cd $2
tar $tarpar $SETUP_WORKING_DIR/$1
cd $SETUP_WORKING_DIR
}
tarpar="-xf "
if [ "$SHOW_EXTRACTED_FILESNAMES" = "1" ]
then
tarpar="-xvf "
fi
SETUP_INSTALL_PATH="$SETUP_INSTALL_PATH"
echo SETUP_INSTALL_PATH=$SETUP_INSTALL_PATH
check_dir $SETUP_INSTALL_PATH
# Installing
log_write 0 "Installing --> $SETUP_INSTALL_PATH"
tarx jobscheduler_unix_universal_agent.tar $SETUP_INSTALL_PATH
if [ -z "$UNIVERSAL_AGENT_PORT" ]
then
$UNIVERSAL_AGENT_PORT=4445
fi
mv `dirname $0`/jobscheduler_agent_$UNIVERSAL_AGENT_PORT.sh $SETUP_INSTALL_PATH/jobscheduler_agent/bin
chmod a+x $SETUP_INSTALL_PATH/jobscheduler_agent/bin/jobscheduler_agent_$UNIVERSAL_AGENT_PORT.sh
log_write 0 "Start JobScheduler Universal Agent"
log_write 0 $SETUP_INSTALL_PATH/jobscheduler_agent/bin/jobscheduler_agent_$UNIVERSAL_AGENT_PORT.sh start
$SETUP_INSTALL_PATH/jobscheduler_agent/bin/jobscheduler_agent_$UNIVERSAL_AGENT_PORT.sh start 1 > /dev/null
exit $? |
Anchor | ||||
---|---|---|---|---|
|
The installer configuration file contains an <installation>
element for each JobScheduler Universal Agent instance.
The following code block shows a minimal example for the installer configuration file:
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="utf-8"?>
<installations lastRun="2015-11-06 15:11">
<globals>
<transfer>
<settings><![CDATA[C:\Temp\batch_install\yade_agent_batch_installer_settings.ini]]></settings>
</transfer>
</globals>
<installation lastRun="2015-11-06 15:11">
<install_path><![CDATA[/home/test/temp/xxx]]></install_path>
<agent_options>
<scheduler_http_port>4445</scheduler_http_port>
<scheduler_ip_address><![CDATA[192.11.0.116]]></scheduler_ip_address>
</agent_options>
<ssh>
<user><![CDATA[test]]></user>
<password><![CDATA[12345]]></password>
<sudo_password><![CDATA[12345]]></sudo_password>
<auth_method><![CDATA[password]]></auth_method>
<port><![CDATA[22]]></port>
</ssh>
<postprocessing>
<command><![CDATA[echo ${ssh.sudo_password} | sudo -S cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler]]></command>
<command><![CDATA[echo ${ssh.sudo_password} | sudo -S update-rc.d jobscheduler defaults]]></command>
</postprocessing>
</installation>
</installations> |
The <globals>
element is used to specify values that are used for all installation items. The items that are specific for an individual installation will overwrite the global values. An installation item is required for each Agent. You can use substitution in the values of the elements.
Code Block | ||
---|---|---|
| ||
Code Block | ||
| ||
<command>echo ${ssh.sudo_password} | sudo cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler</command> |
Anchor | ||||
---|---|---|---|---|
|
Configuring complex XML files with a text editor is often a tedious and error-prone procedure. To get around this, we recommend that you use our XML Editor to manage the configuration files required for the Batch Installer. The XML Editor automatically validates configuration files and therefore reduces the possibility of configuration errors.
Find more details from our XML Editor article.
- After downloading the XML Editor, extract the zip file, then start the "
sos.xml.editor.exe
" file. (The XML Editor runs on Windows systems and does not need to be installed.) - Open your installer configuration file in the Editor and assign the XSD
scheduler_universal_agent_installations.xsd
schema.
Managing the YADE file transfer profiles
Each installation makes use of a profile in the YADE settings file. The default profile name is <host>:<port>
where:
<host>
is substituted with the value from the element<installation><agent_option><scheduler_ip_address>
and<port>
is substituted with the value from the element<installation><agent_option><scheduler_http_port>
- Specify the name of the YADE settings file with the
<globals><settings>
element. - Open the YADE settings file or create a new one.
- Assign the XSD Schema http://www.sos-berlin.com/schema/yade/YADE_configuration_v1.0.xsd
- Add a
<ProtocolFragments>
element and nodes for each host that you want to install the JobScheduler Universal Agent for. - Add a
<Profile>
element and nodes for each host you want install the JobScheduler Universal Agent for. - The default
profile_id
is<host>:<port>
. If you do not use the default then you have to specify the profile name in the installer configuration file.
Change Management References - Batch Installation
Jira | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
<installations lastRun="2015-11-06 15:11">
<globals>
<transfer>
<settings><![CDATA[C:\Temp\batch_install\yade_agent_batch_installer_settings.ini]]></settings>
</transfer>
</globals>
<installation lastRun="2015-11-06 15:11">
<install_path><![CDATA[/home/test/temp/xxx]]></install_path>
<agent_options>
<scheduler_http_port>4445</scheduler_http_port>
<scheduler_ip_address><![CDATA[192.11.0.116]]></scheduler_ip_address>
</agent_options>
<ssh>
<user><![CDATA[test]]></user>
<password><![CDATA[12345]]></password>
<sudo_password><![CDATA[12345]]></sudo_password>
<auth_method><![CDATA[password]]></auth_method>
<port><![CDATA[22]]></port>
</ssh>
<postprocessing>
<command><![CDATA[echo ${ssh.sudo_password} | sudo cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler]]></command>
<command><![CDATA[echo ${ssh.sudo_password} | sudo update-rc.d jobscheduler defaults]]></command>
</postprocessing>
</installation>
</installations>