Script to generate connection information for DataSync

Script to generate connection information for DataSync

By  jwardza

The recommended Best Practices is to remove devices that are no longer being used. And to keep the number of devices down to less than 150 per server. I had an issue where users were testing out different devices then stop using them and not asking us to remove the device. And via the Web console it is very difficult to find devices that are no longer being used.

To fix that I wrote a simple script to query the Mobility Database and write that information to a Web Page. The script is below.

With the upgrade to version 1.2.5 you can have about 750 devices now. Also the schema has changed. I have added the changes to the script to query version 1.2.5.

  1. I created a script in /usr/local/sbin with a name of
    export PGPASSWORD=xxxxxx
    psql mobility -c "select userid,tstamp,devicetype,identifierstring from devices order by userid;" -U datasync_user -H -o /tmp/devices.html
    scp /tmp/devices.html

    Note: If running 1.2.5 use the line below.
    psql mobility -c "SELECT name,tstamp,devicetype,identifierstring FROM devices, users WHERE devices.userid=guid order by name;" -U datasync_user -H -o /tmp/devices.html

    You will need to know the password for the mobility database, you set it when installed Datasync. That password goes in place of xxxxx in the export PGPASSWORD line.

    The last line of the script scp's devices.html to one of our web servers. I used trusted keys between our Linux servers so no password is required.

  2. Add the following to your crontab. I run the script every 15 minutes.
    */15 * * * * /usr/local/sbin/

If you look at the output you can see all the devices. You can tell which devices are no longer being used by looking at the tstamp (Time Stamp). You can contact the user and ask him to remove his account from that device. And then you can delete the device from Data Sync.

There are other fields you can query. Those are:


Have fun!
Labels (1)


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
We have many users who like to add devices to Datasync but never tell us when they stop using them. I worte this script to find devices no longer is use.
Very cool, i'm going to test the script.
I hope novell will make something like this inside the datasync webinterface.

This script is just what I needed. Would be nice if Novell gave us the functionality native in the web interface 😉
Top Contributors
Version history
Revision #:
5 of 5
Last update:
‎2020-02-21 17:39
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.