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.
- I created a script in /usr/local/sbin with a name of devices.sh
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 email@example.com:/srv/www/htdocs
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.
- Add the following to your crontab. I run the script every 15 minutes.
*/15 * * * * /usr/local/sbin/devices.sh
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:
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.