The Platform database (PlatformDb) is used by SWA and the Mobile client to provide fast access to message headers. The contents of the database are populated per-user the first time a user accesses each folder in their mailbox. Normally, changes are incrementally synchronized between from the Scalix IMAP server into the database; however, when first migrating to Scalix, setting up an additional server deployment, or if the database is recreated, a full synchronization will occur. For users with large mailboxes, this can create a noticeable delay in the login process; in the worst case causing the login to timeout, forcing the user to re-login to access their mailbox. Though this is a one-time occurrence, it can be beneficial to synchronize the contents beforehand to avoid any problems. The sxapiprep.py tool can be used for that purpose.
Before using the tool, a user must exist which has the mboxadmin capability. To add this capability to a user, one can use ommodu. For example:
ommodu -o TestUser -c +mboxadmin
To run sxapiprep.py for all users in the system, all that is needed is to provide the tool with the user's credentials, and it will locate and process each one in turn. By default, omsearch is used to obtain the list of users, which means that sxapiprep.py should be executed as root.
[root@test9]# ./sxapiprep.py -u TestUser -w password Searching for users... found 1022. sxadmin (1 of 1022)... INBOX: 2.09 Calendar: 0.54 Contacts: 0.65 Sent Items: 0.61 Total: 3.90 Skipping: sxqueryadmin User0 Test0 (3 of 1022)... INBOX: 2.97 Calendar: 0.74 Contacts: 0.82 Sent Items: 0.87 Total: 5.40 User1 Test1 (4 of 1022)... INBOX: 2.39 Calendar: 0.75 Contacts: 0.79 Sent Items: 0.76 Total: 4.69 User2 Test2 (5 of 1022)... INBOX: 2.42 Calendar: 0.71 Contacts: 0.78 Sent Items: 0.77 Total: 4.68 User3 Test3 (6 of 1022)... INBOX: 0.91 Calendar: 0.66 Contacts: 0.74 Sent Items: 0.76 Total: 3.07
It is also possible to execute the tool for a subset of users, by providing their names on the command line or in a text file. To obtain a text file suitable for using with sxapiprep.py, use omsearch, specifying the CN and IA-FORMAL user attributes. For example:
[user@test9]$ sudo omsearch -d SYSTEM -e 'ENTRY-TYPE=1' -m 'CN/IA-FORMAL' -s | head -100 > /tmp/users.list [user@test9]$ ./sxapiprep.py -u TestUser -w password -f /tmp/users.list Searching for users... found 100. sxadmin (1 of 100)... INBOX: 0.55 Calendar: 0.60 Contacts: 0.60 Sent Items: 0.63 Total: 2.38 Skipping: sxqueryadmin User0 Test0 (3 of 100)... INBOX: 0.56 Calendar: 0.23 Contacts: 0.35 Sent Items: 0.29 Total: 1.43 User1 Test1 (4 of 100)... INBOX: 0.32 Calendar: 0.24 Contacts: 0.27 Sent Items: 0.36 Total: 1.20 ...
When using a text file or a command line list, it is not necessary for the tool to execute omsearch itself, which provides the benefit that sxapiprep.py can then be run by a non-privileged user. To specify users on the command line, provide a comma-separated list of names in the form '[Given] Surname' or 'S=Surname[/G=Given]' where the portions in brackets are optional. For example:
[user@test9]$ ./sxapiprep.py -u TestUser -w password -U 'User0 Test0,S=Test3,S=Test4/G=User4' Searching for users... found 3. User0 Test0 (1 of 3)... INBOX: 0.76 Calendar: 0.58 Contacts: 0.99 Sent Items: 0.83 Total: 3.16 User3 Test3 (2 of 3)... INBOX: 1.09 Calendar: 0.52 Contacts: 0.53 Sent Items: 0.57 Total: 2.70 User4 Test4 (3 of 3)... INBOX: 2.76 Calendar: 0.72 Contacts: 0.77 Sent Items: 0.78 Total: 5.03
When specifying users on the command line, sxapiprep.py uses CAA to obtain user information, so the account credentials given should have the necessary permissions for that task.
By default the INBOX, Calendar, Contacts, and Sent Items folders are accessed by the tool. The list may be customized by using the '-F' option. Any folder may be specified, but since the folder list is used for all users it should be a folder which every account will have.
[user@test9]$ ./sxapiprep.py -u sxadmin -w secret12 -U 'Test0,Test1' -F 'Deleted Items' Searching for users... found 2. User0 Test0 (1 of 1)... Deleted Items: 0.75 Total: 0.75 User1 Test1 (2 of 2)... Deleted Items: 1.74 Total: 1.74
A full list of options to sxapiprep.py is available by executing it with the '-h' or '--help' argument.
[user@test9]$ ./sxapiprep.py -h usage: sxapiprep.py [options] options: -h, --help show this help message and exit -uUSER, --user=USER Username (required) -wPASSWORD, --password=PASSWORD Password (required) -fUSERFILE, --file=USERFILE File with list of users -UUSERLINE, --users=USERLINE Comma separated list of users. Format is: '[Given] Surname' or 'S=Surname[/G=Given]' -FFOLDERS, --folders=FOLDERS Comma separated list of folders, eg. 'INBOX, Calendar, Contacts' -HAPIHOST, --apihost=APIHOST Server hostname for Platform/API -CCAAHOST, --caahost=CAAHOST Server hostname for SAC/CAA -RREALM, --realm=REALM API auth realm -S, --ssl Use SSL to connect to CAA and API