Using Scripts

In the Console mode and the GUI mode, the actions are recorded in the form of a script (targets_config.bat or targets_config.sh). This script can be modified and re-used later.

The last screen during upgrade or downgrade, that is, the Summary screen shows the location where the scripts are saved (Session Scripts and Log Folder). This folder contains a "Batch" script or a "Shell" script ( depending on the operating system) in the scripts folder.

You can double-click the batch file to run it. It starts executing whatever was selected during TCT screens.

In the Summary screen (GUI mode only), if you choose to skip any of the four actions ("Stop", "Upgrade", "Perform post-upgrade task" and "Start" Host) and save it, the build.properties file is updated to reflect this.

For example, if you choose to skip "Stop All Host" and skip "Start All Hosts", you will see two new properties added to the build.properties file.

skip.host.stop=true 
skip.host.start=true

ANT scripts

TCT at the end of the wizard creates a build.xml file that is the main ANT build file. Using this ANT file, TCT performs upgrade or downgrade. You can run this build.xml file manually as well.

The build.xml file takes its input from the build.properties file. Any upgrade or downgrade instructions or settings must be added to this file.

The build.xmlalso imports some other ANT build files needed to run upgrade or downgrade:
File Description
tct-tools.xml This is standard tct build file - have "-init" target in it.
patchmgr-task-3.4.0.xml This is an XML file that sets a CLASSPATH for running the Host Manager commands. Most of the upgrade and downgrade is performed by the Host manager located in TIBCO_HOME\amx\3.4\bin. ANT calls the Host manager using an ANT task. This file defines the ANT tasks and sets a CLASSPATH for them.
tct-helper.xml This build file defines a code for many of the targets that are exposed in the top level build.xml. It defines "do.run.upgrade.downgrade, do.stop, do.upgrade_downgrade and do.post_upgrade targets.
process_form_apps.xml This build file is actually not used by the top-level build.xml file but rather used by tct-helper.xml. this build file defines targets that are needed for platform app upgrade or downgrade.
There are 5 main ANT targets:
ANT Target Description
run.upgrade.downgrade Default target. This target performs Stop, Upgrade or Downgrade, post upgrade task, and Start for each host you have selected. Selection details are taken from the build.properties file.

When this target is runs, it calls do.stop, do.upgrade_downgrade, do.post.upgrade and do.start sub-targets.

Stop This target performs Stop on the selected host. The selection is taken from the build.properties file. Either selectAll is set to true (that is, all hosts in the CONFIG_HOME) or a comma-separated list of host names as the value for the property upgrade.tibcohost/downgrade.tibcohost). This target calls ANT taskdef "patchmgr.StopAllHosts" -calls the Host manager command (./tibamx_hostmanager.exe stopAllHosts).

This target calls the do sub-target defined in tct-helper.xml.

upgrade_downgrade This target performs either upgrade or downgrade on the host. Selection is taken from build.properties file. Either property selectAll is set to true (that is, all Hosts in CONFIG_HOME) or comma-separated host names as value for the property upgrade.tibcohost/downgrade.tibcohost). This target calls ANT taskdef "patchmgr.Upgrade" or "patchmgr.Downgrade" - that calls the Host manager command (tibamx_hostmanager.exe upgradetibamx_hostmanager.exe downgrade. This target calls the do.upgrade_downgrade sub-target that is defined in tct-helper.xml.

This target has the following sub-targets that can be called before run.upgrade.downgrade and it enables you to skip certain actions:

  • skip.host.start: skip host start
  • skip.host.stop : skip host stop
  • skip.upgrade.or.Downgrade: skip host upgrade or downgrade ( based on build.properties input)
  • skip.post.upgrade: skip post upgrade

For example:

ant -f skip.host.start run.upgrade.downgrade

ant -f skip.upgrade.or.Downgrade skip.post.upgrade run.upgrade.downgrade

start This target performs "Start" on the selected host. The selection is taken from the build.properties file. Either property selectAll is set to true (that is, all hosts in the CONFIG_HOME) or a comma-separated list of host names as value for the property upgrade.tibcohost/downgrade.tibcohost). This target calls ANT taskdef "patchmgr.StartAllHosts" - that calls the Host manager command (./tibamx_hostmanager.exe startAllHosts).

This target calls do .start sub-target that is defined in tct-helper.xml.

post.upgrade This target performs a "post-upgrade" action during the upgrade process. This target also calls ANT taskdef "patchmgr.UpdateManifest" - that calls the Host manager command ( ./tibamx_hostmanager.exe updateManifest). This target calls do.post.upgrade sub-target defined in tct-helper.xml. This target is only relevant during the upgrade action (in build.properties file isUpgrade is set to true.)
Note: If you want to perform only the target action (such as STOP), you can select a host or all hosts in the given CONFIG_HOME and call individual targets like "stop" defined in build.xml. If you want to perform stop, upgrade/downgrade, post upgrade and start on the selected host, it is recommended that you call the run.upgrade.downgrade target.
Note: Upgrading by executing the scripts manually and by executing them through the TCT Wizard are different. TCT performs additional sequencing which cannot be done by the ANT scripts.

Is "ant -f build.xml stopupgrade_downgrade post.upgrade start" the same as "ant -f build.xml run.upgrade.downgrade" ?

No. If you call targets "stop upgrade_downgrade post.upgrade start", ANT calls each target one after the other. For example, consider 3 hosts in a CONFIG_HOME. If you call targets described as before, ANT calls the stop target first and it stops all 3 hosts. Then, it calls the upgrade_downgrade target and performs either upgrade or downgrade depending on the input selected in the build.properties file for all 3 hosts. Then, it performs the post.upgrade followed by calling the start target.

Sample Output - Success

[11 Jun 2018 18:02:31,420] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Ant properties
#Sun Jun 11 18:02:31 PDT 2018
tibco.host.Admin-dev-enterprise-instanceOne.Downgrade.status=SUCCESS
tibco.host.RunTimeHost.Downgrade.status=SUCCESS
tibco.host.RunTimeHost11.Downgrade.status=SUCCESS
tibco.host.RunTimeHost2.Downgrade.status=SUCCESS
tibco.host.RunTimeHost3.Downgrade.status=SUCCESS
tibco.host.RunTimeHost4.Downgrade.status=SUCCESS
tibco.host.RunTimeHost5.Downgrade.status=SUCCESS
tibco.host.RunTimeHost6.Downgrade.status=SUCCESS
tibco.host.RunTimeHost7.Downgrade.status=SUCCESS
tibco.host.RunTimeHost8.Downgrade.status=SUCCESS
tibco.host.RunTimeHost9.Downgrade.status=SUCCESS
[11 Jun 2018 18:02:31,422] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sample Output - Failure

[12 Jun 2018 13:44:29,636] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Ant properties
#Mon Jun 12 13:44:29 PDT 2018
tibco.host.RuntimeHost3.Upgrade.status=FAILURE
tibco.host.RuntimeHost3.Upgrade.status.error=The following error occurred while executing this line\:\r\nC\:\\tibco_amx331_for_340\\amx\\3.4\\scripts\\upgrade\\upgrade-to-3.4.0\\platformApp\\tct-helper.xml\:316\: The following error occurred while executing this line\:\r\nC\:\\tibco_amx331_for_340\\amx\\3.4\\scripts\\upgrade\\upgrade-to-3.4.0\\platformApp\\tct-helper.xml\:328\: The following error occurred while executing this line\:\r\nC\:\\tibco_amx331_for_340\\amx\\3.4\\scripts\\upgrade\\upgrade-to-3.4.0\\platformApp\\process_platform_apps.xml\:237\: The following error occurred while executing this line\:\r\nC\:\\tibco_amx331_for_340\\amx\\3.4\\scripts\\upgrade\\upgrade-to-3.4.0\\platformApp\\process_platform_apps.xml\:275\: One of the nodes failed to perform upgrade of platform App - please check logs at \: E\:\\amxconfig\\config_331_RuntimeHost2\\tct\\tct.upgrade.downgrade\\2018-06-12-13-20-10\\logs\\platformApp.logs\\12-Jun-2018-13_43_40.updatePlatformApp.admin.cmdline.log for more information
tibco.host.RuntimeHost4.Upgrade.status=FAILURE
tibco.host.RuntimeHost4.Upgrade.status.error=The following error occurred while executing this line\:\r\nC\:\\tibco_amx331_for_340\\amx\\3.4\\scripts\\upgrade\\upgrade-to-3.4.0\\platformApp\\tct-helper.xml\:242\: TIBCO-AMX-TOOLS-PATCHMGR-000601\: One or more Host instances have not started or they are still starting. Make sure all Host instances have started. Start a Host instance manually if it has not started.
[12 Jun 2018 13:44:29,652] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~