# Automatic Updating of NeXus Files

Some instruments perform measurements for quite long counting times. In such cases it is advisable to save the data measured so far to file in order to protect against hardware or software failures. To this purpose an automatic file upgrade manager is provided. On installation the automatic update object is connected wth a counting device through the the callback interface. This makes sure that the update manager is automatically notified when counting starts or finishes.

## Prerequisites for Using the Automatic Update Manager

In order to use automatic updating, three programs must be provided. Each of these programs can be a script which uses the nxscript facility. It can also be a SICS command.

startScript
  This program is supposed to write the static part of the file. It is called once when the file is created.
updateScript
  This program is supposed to create and update the variable data elements in the NeXus file. This is called frequently.
linkScript
  This program is supposed to create the links within the NeXus file. This is called once after startcript and updateScript have been run.

## Installing Automatic Update

An automatic update object is installed into SICS with:

    updatefactory name countername

name is a placeholder for the name under which SICS knows the automatic update object. name is available as a SICS command later on. countername is a placeholder for a counter object (counter or HM) which triggers automatic updating of NeXus files. This object has to support both the countable and callback interfaces of SICS. Suitable SICS objects include counter and histogram memory objects.

## Configuring Automatic Update

The SICS command created with updatefactory (see above) supports a few parameters which allow for the configuration of the whole process. Parameters follow the normal SICS syntax. Futhermore there is a subcommand list, which lists all configuration parameters. Supported parameters are:

startScript
  The program supposed to write the static part of the file.
updateScript
  The program supposed to create and update the variable data elements in the NeXus file.
linkScript
  This program supposed to create the links within the NeXus file.
updateintervall
  The time intervall in seconds between updates. The defualt is 1200, eg. 20 minutes.