Maintenance scripts
Maintenance scripts allow you to run utilities for logging and maintaining your synchronizations.
Fix script
The Fix script cleans up the data in the database.
This script is not meant to be used on a regular basis. You primarily use it to clean up stale and corrupt data, resulting from a product upgrade.
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.
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
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
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
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
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.
Purge scripts
The Purge script performs the following actions:
- Deletes all iteration data from the Connect database.
- Removes old logging and audit data from the database and log files.
- Purges the dead space from the file system.
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. For details, see Purge files on Windows as a nightly task.
Stopping and restarting the Connect server clears out the process runtime memory cache.
Tip: If you would like the nightly purge to automatically generate a nightly audit report, add the Audit command to the purge script. For details, see Audit script.
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
Additional purge scripts
The following purge scripts are also available:
Script | Purpose |
---|---|
PurgeDisabledProjects |
Removes all disabled projects across all connections from the database. Note: To target a single connection, include the connectionname parameter. |
PurgeDisabledTypes |
Removes all disabled types across all connections from the database. Note: To target a single connection, include the connectionname parameter. |
PurgePreviousPasswords | Removes all previous passwords across all authenticator users from the database. |
Purge script effects on resources
When the Purge script runs, it extracts the audits stored in the database since the last purge run. It also produces a .zip backup of the data folder, containing the most recent snapshot since the last purge. If SMTP email is configured, it also emails a .zip attachment of the audit extraction, to the addressees that were configured.
The size of the audit file and its content are directly affected by the success or failure of the Connect configuration. The more errors recorded in the audits, the larger the audit file. In general, we recommend increasing your disk space beyond the minimum required size since Connect is a resource intensive service. For details, see Windows installation.
The purpose of the audit file productions is to review and investigate errors and determine how to solve them. If the synchronization errors are not relevant for your environment, you may turn off the audit file.
To turn off the auditing:
-
Open the mfcpurge.bat file, and rem out the line that calls audit.jar. Save the file.
-
Run the Purge script or add it to your automated tasks.
-
Set up a nightly job to delete all older audit and data .zip backups, for example seven or more days old. For details, see Purge files on Windows as a nightly task.
Audit script
The Audit script generates a de-normalized flat .txt file representation of the audit UI log entries using the pipe character, |, as the column separator.
The file is given a timestamp and saved in the <Connect_installdir>\AppData\backup folder. The file can be imported into a spreadsheet or an SQL database for backup, querying, reporting, or general processing.
Note: The generated text file provides more details than the Troubleshooting. If you purge the database at regular intervals, the Audit tab only shows the data since the last purge. Older audit data is exported into a file by the Batch utility scripts, and saved in the backup folder.
Row subset
You can produce a subset of the audit rows by specifying the connections by their name. Use the following syntax: connectionnames=connectionname1,connectionname2,… parameter
If you use the default and do not specify connection names, you receive the rows from all of the connections.
Column subset
You can produce a subset of the audit columns by specifying the column names. Use the following syntax: columnnames=columnname1,columnname2,… parameter
.
If you use the default, and do not specify column names, you get all of the columns.
The following is an alphabetical list of the available columns : action, actionvalue, associatedid, endtime, fieldname, fieldvalue, itemactionid, itemid, iterationid, starttime, stacktrace, sourceproject, sourcetype, syncguid, targetproject, and targettype.
Time-based subset
You can produce a subset of the audit rows using the datetime=yyyy-mm-dd parameter. You can specify the data after a specific date. For example datetime=2022-01-03
returns rows that were added after January 3, 2022.
If you use the default, and do not specify a date and time, you get all of the data.
Syntax examples
The following examples show common usages of this utility.
-
This example produces the default report, including all connections with all of the column names:
"%JRE_PATH%\java.exe" -jar "%UTILITIES_PATH%\mfcAudit.jar" "%CONNECT_PATH%" "|" "%BACKUP_PATH%" “connectionnames=” “columnnames=” "datetime="
-
This example produces a report for the connection named ‘CONN’ with a subset of the columns:
"%JRE_PATH%\java.exe" -jar "%UTILITIES_PATH%\mfcAudit.jar" "%CONNECT_PATH%" "|" "%BACKUP_PATH%" “connectionnames=CONN” "columnnames=starttime,sourceproject,itemid,fieldname,fieldvalue,actionvalue" "datetime="
ResetPassword script
The ResetPassword script resets the password of the Administrator user, replacing it with the string changeme.
This script is especially useful when a customer is locked out of Connect.
A subsequent login through the UI requires changeme to be the specified password, and the user is prompted to provide a new password.
See also: