Command Line Admin Tools

Two command line tools have been created to make it easier to manage server configurations and user repositories.

Configuration tool allows to look at configuration settings and modify parameters. It takes care of proper parameters types and encoding.

Repository management tool allows to print repository content for all or for selected users. Modify repository data, add, delete users and copy data from one repository to another.

This guide describe how to efficiently use command line tools which are available for user repository and configuration management.

These 2 command line tools for managing configuration and repository are:

  1. for configuration management.
  2. for repository management.

Both scripts call class from Tigase package. If you run any of those script with -h parameter you will get help screen describing all available parameters.

I will not concentrate on that help information which is easily accessible anyway. This guide will focus on particular use cases. So it will answer the question: "How to do use the tool?".

Configuration Management Tool

The configuration tool allows a user to look at configuration settings and modify parameters.

First, an answer to the question: "Why use this configuration tool instead of directly, manually editing the config file?"

There are a couple of reasons why you should NOT manually edit configuration file and use the tool instead to modify settings:

  1. Configuration is kept in XML file which can be easily broken if not edited carefully. The tool takes care of creating valid XML configuration file for you. So you can focus on your task - setting proper parameters for your server.
  2. Configuration values are kept UUEncoded in the config file. If you edit file manually you have to take care of proper encoding of special characters. The tool presents parameters to you in decoded form which is easy to read and can accept all settings also in decoded form which is easier for you to write. Then when writing your parameters to configuration file settings are automatically encoded to correct form.
  3. Data in configuration file have TYPES. That is some parameters are expected to be Strings other are expected to be Integers, Booleans or arrays keeping data in any of that type. If data type is set incorrectly then Tigase may have problems with reading configuration data. The configuration tool takes care of proper data types in configuration file.

Configuration management tool is a Java class - tigase.conf.Configurator. To make it easier to use this class there is also shell script available -

First thing you can do is running the script with -h parameter:

./scripts/ -h

In response you get description of all available parameters:

 -h             this help message
 -c file        configuration file
 -key key       node/key for the value to set
 -value value   value to set in configuration file
 -set           set given value for given key
 -add           add given value to the values list for given key
 -print         print content of all configuration settings or of given node/key
 -f             force creation of the new property - dangerous option...
 Setting admin account - overwriting any previous value(s)
 $ ./scripts/ -c tigase-config.xml -print -set -key session_1/admins -value admin1@localhost
 Adding next admin account leaving old value(s)
 $ ./scripts/ -c tigase-config.xml -print -add -key session_1/admins -value admin2@localhost

Note: adding -print option is useful always, even with -set or -add
      option as it prints set value afterwards.

Let’s assume configuration for your server is located in tigase-config.xml file. So the first thing you need to set when calling the tool is location of the configuration file.