Access Keys:
Skip to content (Access Key - 0)
Cancel    
Cancel   
 

Contents

Scripting Examples

This page provides examples of using scripts.

Redeploying a Named Package

This simple script grabs a package with a particular name and redeploys it using the provisioning service.

Automatically Redeploying After an Artifact Update

If you're using the Maven plug-in or the API to update a WAR, you may want to listen for the update and automatically redeploy any packages associated with it. The following script installs an event listener, which listens for updates to an item's artifact property, which changes when the WAR file data has been changed. When this event occurs, the script searches for any deployment packages with this particular artifact and redeploys them.

Sending Notifications of New Artifact Versions

This script watches for new artifact versions and sends an email to any user who is registered in the "contacts" property.

Replicating Workspaces

You can replicate workspaces from one Tcat Server instance to another. Replications are performed via custom scripts. This allows you to easily customize the replication process and schedule it via the Scheduler.

Replication occurs by copying artifacts and entries from one workspace to another. If you're replicating to a remote Tcat Server instance, you must first attach it as a remote workspace.

Once you have both your origin and destination workspace in mind, you can create a script that performs this replication. Following is an example script:

This script copies all artifacts and entries from LocalWorkspace to RemoteWorkspace. Note that it is beneficial to give your replicators an ID, in this case myReplicator. This makes it easy to view the actions of the replicator in the activity log.

Restarting Servers

If you need to restart a server, you can easily do it through the administration console. However, what if you wanted to schedule a automatic restart at a particular day/time? You can achieve this by writing a script and scheduling it with the scheduler. Following is an example script:

To restart ALL servers, except the Tcat Admin Console Server, you could use the following script:

Once you have saved this script, it is easy to schedule this script to be run periodically via the scheduler.

<< Previous: Automating Tasks Next: Creating Custom Policies >>