Maintenance scripts
Maintenance scripts allow you to run utilities for logging and maintaining your synchronizations.
FullRestClient script for global properties
The FullRestClient script lets you retrieve and set global properties. A common use of this script is to enable or deactivate web sockets within Connect.
Retrieve all global properties
Usage: java -jar .\mfcFullRestClient-<version>.jar -h <host> -c <username>,<password> -getGlobalProperties
Example: java -jar .\mfcFullRestClient-5.0-SNAPSHOT.jar -h localhost:8080 -c Administrator,Password -getGlobalProperties
Search for a global property by name
Usage: java -jar .\mfcFullRestClient-<version>.jar -h <host> -c <username>,<password> -searchGlobalPropertyByName <name>
Example: java -jar .\mfcFullRestClient-5.0-SNAPSHOT.jar -h localhost:8080 -c Administrator,Password -searchGlobalPropertyByName websockets-enabled
Set a global property value
This capability is only available for users with Admin or Site roles.
Usage: java -jar .\mfcFullRestClient-<version>.jar -h <host> -c <username>,<password> -setGlobalPropertyValue -propertyName <name> -propertyValue <value>
Example: java -jar .\mfcFullRestClient-5.0-SNAPSHOT.jar -h localhost:8080 -c Administrator,Password -setGlobalPropertyValue -propertyName websockets-enabled -propertyValue false
Enable or deactivate web sockets
By default, web sockets are enabled. To change this behavior, set the websockets-enabled global property to either true or false.
Usage: java -jar .\mfcFullRestClient-<version>.jar -h <host> -c <username>,<password> -setGlobalPropertyValue -propertyName websockets-enabled -propertyValue <value>
Example (disabling web sockets): java -jar .\mfcFullRestClient-<version>.jar -h <host> -c <username>,<password> -setGlobalPropertyValue -propertyName websockets-enabled -propertyValue false
Set script execution limits
By default, script execution is limited by time in order to prevent it from running too long and consuming excessive resources. There is also a limit in the number of statements a script can evaluate. These limits are configurable through mfcFullRestClient script properties:
Property | Default | Meaning |
---|---|---|
script.evaluator.execution.timeout.millis | 20000 ms | The maximum execution time of a script. |
script.evaluator.interrupt.await.timeout.millis | 5000 ms | The maximum amount of time a script is given to terminate gracefully (for example, run a final statement block) when interrupted by script.evaluator.execution.timeout.millis. |
script.evaluator.statement.limit | 500 | The maximum number of statements a single evaluator can execute. |
-
For the execution timeout property, script.evaluator.execution.timeout.millis: When script execution exceeds this time, it is interrupted and an error is triggered. This timeout cannot be deactivated, but it can be increased. If you assign this property a high value, it will take a longer time for a problematic script to hang.
-
For the interrupt property, script.evaluator.interrupt.await.timeout.millis: When the termination duration exceeds this time, the script is stopped forcefully. This timeout cannot be deactivated, but it can be increased. If you assign this property a high value, it will take a longer time for a problematic script to hang.
-
For the statement property, script.evaluator.statement.limit: When the amount of statements executed exceeds this amount, an error is triggered. Set this property to 0 to deactivate the statement limit.
The following example sets the statement limit to 750:
java -jar .\mfcFullRestClient-5.0-SNAPSHOT.jar -h localhost:8080 -c Administrator,Password --setGlobalPropertyValue -propertyName script.evaluator.statement.limit -propertyValue 750
Maintenance script
The Maintenance utility can be used to move project maps from one connection into a new connection, within the same application instance. Run the utility using the following syntax: java -jar mfcMaintenance.jar
.
For a typical connection, use the following options to move project mappings from one connection to another. To see a list and description of all of the available options, run the utility with no options.
java -jar mfcMaintenance.jar \
-basePath "<base_path_of_connection>" \
-migrateProject \
-synchronizationName "<name of original connection>" \
-newSynchronizationName "<name of new connection>" \
-projectMapping "sourceProject:TargetProject"
The following example looks for a synchronization named Connection A that has project mappings source1:target1 and source2:target2, and moves these mappings into a new synchronization named Connection B.
java -jar mfcMaintenance.jar \
-basePath "C:\Connect" \
-migrateProject \
-synchronizationName "Connection A" \
-newSynchronizationName "Connection B" \
-projectMapping "source1:target1" -projectMapping "source2:target2"
When using the Maintenance utility, follow these guidelines:
-
To move multiple project maps, repeat the projectMapping option:
-projectMapping "source1:target1" -projectMapping "source2:target2"
-
If a project name contains a colon (such as in Jira), precede it with the backslash escape character, ‘\’. For example, to use the name source:1 add a backlash before the colon:
-projectMapping "source\:1:target\:1"
. This example also shows a non-escaped colon, as you only need the escape colon within the project name.
mfcPurge script
The mfcPurge script performs the following actions:
- Removes old logging from the database and log files.
- Purges the dead space from the file system.
To clean up iteration data from the Connect database, use the Global settings as described in Audit settings.
Recommended configuration
Set the script to run as a nightly, scheduled batch process, preferably at a time that causes the least inconvenience to users. If run every night, the script should require no more than 15 minutes of Connect server downtime. The Windows Scheduled Tasks and Linux CRON jobs must run before the cleanup time set in the Audit settings. For details, see Purge files on Windows as a nightly task.
Stopping and restarting the Connect server clears out the process runtime memory cache.
Additional uses
You can use the Purge script as a general purpose utility to perform additional tasks that you need to run on a nightly basis. These include:
-
Data folder backups
-
Automatic clearing of watermarks across all connections
-
Extracting users from endpoint systems and importing them into the Connect database user maps
-
Stopping all connections, then starting and running them, one connection, one iteration at a time
-
Stopping all connections, then starting each connection, one at a time
-
Running custom scripts outside the context of Connect
ResetPassword script
The ResetPassword script resets the password of the Administrator user, replacing it with a randomly generated alphanumeric password. This script is useful when a customer is locked out of Connect.
The new password is displayed in the command line output of the script.
A subsequent login through the UI requires the newly generated password to be specified, and the user is prompted to provide a new password.
See also: