Automating file maintenance with xfServer (Windows and Unix)

xfServer can be configured to automatically resynchronize resilient ISAM files on start-up. This is the equivalent of running isutl -s.

Automatic file synchronization is supported only for Revision 6 or higher files when 64-bit xfServer is running on a 64-bit operating system on the default port (2330).

Note

A resilient file that is out of sync must be resynchronized before it can be opened. This happens automatically for remote files when they are opened or updated via 64-bit xfServer. It also happens automatically for local files on open or update if rsynd is running on the system as described in Resynchronization and resilience. The primary difference between those methods and the one described in this topic is that when you configure xfServer for automatic resynchronization, files are checked and, if necessary, resynchronized when xfServer starts up rather than when the file is opened or updated.

Configuring xfServer for automatic file resynchronization

1. Create a JSON file named rsynd.fmc using the syntax in Creating an rsynd.fmc file below.
2. (recommended) Validate the syntax in your file using a JSON formatter/validator. You can find a number of these online, such as the one at https://jsonformatter.curiousconcept.com/.
3. Place the rsynd.fmc file in c:\ProgramData\Synergex\SynergyDE\dbl on Windows or DBLDIR: on Unix. When xfServer starts up, it will process the file and resynchronize any of the specified ISAM files that are out of sync.

Creating an rsynd.fmc file

The rsynd.fmc file uses JSON syntax. A JSON file starts and ends with braces { } and the body is made up of key–value pairs, with pairs separated by commas. The keyword portion of the pair is always quoted, while the value portion is quoted when it’s a string. If there are multiple values for a keyword, you can group them as show in Specifying files below.

The following keywords are supported. Each keyword may be used only once.

"files" : "filespec"

(required) Specify the files to process. You can specify individual files or use wildcards (such as a*.ism) to specify groups of files in a directory. Always specify the index file, not the data file. Synergy logicals are supported as long as they are defined for rsynd. (See Defining environment variables for xfServer services [Windows] or Defining environment variables for xfServer processes [Unix].) If the full path is not specified, the default rsynd directory is used. If RSFILPATH is not set, the default directory is c:\Users\Public\Documents on Windows and the home directory of the user—either the RUSER client or the effective user (if xfServer is running in that mode)—on Unix. On Windows, you must escape directory delimiters with a backslash (e.g., “c:\\data\\*.ism”).

"exclude" : "filespec"

(optional) Specify files to exclude from the total list of files specified with the files keyword. The file specification is the same as for the files keyword.

"tempdir" : "filespec"

(optional) Specify a location to write temporary files to. If not specified, the rsynd default directory will be used, as explained above for files.

"loglevel" : value

(optional) Specify the level of logging desired in the isutl.log file: 0 (no logging); 1 (default; logs files that are out of sync or fail with an error); 2 (full logging). See Logging below for more information.

Specifying files

The JSON syntax is flexible, making it easy to specify the exact files or directories of files you want to synchronize. It does not matter if some of the files in a directory are resilient and some are not; the non-resilient files will simply be skipped over.

This example specifies a single file to process. On Windows, double backslashes are required in the path.

{ "files":"d:\\data\\myFile.ism" }

You can use wildcards to specify multiple files in a directory. This example will process all ISAM files with the .ism extension in the d:\data directory.

{ "files":"d:\\data\\*.ism" }

If you want to process files from a number of directories, you can create a set of file specifications. (Multiple entries of the files keyword are not allowed.) To do this, enclose several comma-separated paths within braces after the files keyword. In the example below, the labels “GL files” and “AR files” serve as comments and will be ignored during processing. You must have a set of quotations marks before the colon on each line. If you don’t want to use this space for a label or identifier, you can just put a set of quotation marks there, as in the third file specification below, which also demonstrates the use of a logical instead of a path. In this example, files beginning with “la” will not be processed.

{
   "files" : {
       "GL files" : "d:\\data\\gl*.ism",
       "AR files" : "d:\\data\\ar*.ism",
               "" : "ABC:*.ism"
    },
   "exclude" : "d:\\data\\la*.ism",
   "loglevel" : 2,
   "tempdir" : "d:\\temp"
}	
Note

If you have multiple sets of empty quotation marks, the JSON validator may generate a warning about duplicate keys. You can safely ignore these warnings; the empty quotation marks will not cause a problem when processing the rsynd.fmc file.

Logging

Any errors encountered when processing the JSON script are sent to the Windows Event Viewer or /usr/lib/rsynd.log and syslog on Unix and do not stop xfServer from running. When rsynd.fmc is processed successfully, an entry displaying synchronization data is written to this log. For example,

Server File Maintenance (SYNC): 81 checked, 1 re-synced, 1 already in sync, 79 not RESILIENT

Additional logging takes place in the isutl.log file, depending on what value you specify for the loglevel keyword. By default only files that are out of sync or fail with an error are logged. Full logging (2) shows all files processed by rsynd.fmc. This enables you to confirm that every file is being checked, so you may want to specify level 2 when you first set up automated file maintenance or if you make changes to the files list in your rsynd.fmc file. However, we don’t recommend leaving full logging set indefinitely because the log file can get quite large.

The isutl.log file is used by a number of DBMS utilities. Entries from the processing of rsynd.fmc (and from any time rsynd—rather than isutl -s—does the synchronization checking) are prefixed with “(rsynd)”. Isutl.log is located by default in c:\ProgramData\Synergex\SynergyDE\dbl on Windows or DBLDIR on Unix. You can specify a different location (or name) for this file with the ISUTLLOG environment variable.