2.2. Testing the installation

  1. In a shell, type the command:
    [sh]$  writept test1 25
    This will create the point test1 in the DataHub and assign it the value 25. writept does not return any value.
    [Note]

    You will need to use this syntax:

    [sh]$  writept test:test1 25

    if you started the DataHub with the command datahub -d test. This is because the point test1 is in the test domain. Please refer to Section 2.4.3, “Domains and Names” for more information.

  2. At the shell, type the command:
    [sh]$  readpt test1
    or
    [sh]$  readpt test:test1
    The results should look like this:
    Point: test1
    Value: 25
    Time:  Jun 14 10:43:38.896
    Conf: 100
    Lock: 0
    Secur: 0

These tests establish that you can read and write data points to the Cascade DataHub. The syntax for writept and readpt are described in the Utilities reference, and their source code is listed in the Writing data to the Cascade DataHub and Reading from the Cascade DataHub appendicies of the Cogent C API manual.

Shutting down

The simplest way to shut down the DataHub is to send a kill -9 command for the DataHub's process ID. A more graceful and orderly method is to send the exit command using the lsend utility, like this:

[sh]$  ps -aux
...
name   19350  0.0  0.3  3160 1612 ?        S    16:37   0:00 datahub
name   19354  0.0  0.1  2856  868 pts/0    R    16:39   0:00 ps -aux
[sh]$ lsend 19350
/dh/19350> exit()
  </dh/19350 no longer reachable>
/dh/19350(disconnected)>Ctrl-C
[sh]$ 
[Note]

If the DataHub shuts down in any way other than using lsend, it takes Linux or QNX a couple of minutes, more or less, to free up the TCP socket that the DataHub was using. So if you kill the DataHub, you'll have to wait a couple of minutes before attempting to restart it.