Previous Topic

Next Topic

Book Contents

Book Index

Command Line Tool

There is a completely new command line tool which you can use to administer domains and accounts as well as all system variables. This tool is called tool.exe and you can find it directly in the <InstallDirectory> folder. For Linux this is called tool.sh. It is easy to use and you only have to know the API constants. Complete list of API constants is in APIconst.pas file in the <InstallDirectory>\API\Delphi\ folder.

 

note_small

NOTE: Using tool.exe for performing large operation can cause temporary service unavailability because the service needs to be restarted for some changes in configuration. For servers with many domains and many users with high load, restarting can take some time. Therefore, we recommend performing large batches of changes in low-load periods.

note_small

NOTE: Command line tool does not support multi-line – you can encounter this e.g. using the autoresponder variable.

Command

Description

CREATE

Creates a new object. It is followed by a type (domain or account) and a list of variables and values you want to assign to these variables.

DELETE

Deletes an object. It is followed by a type (domain or account) and a unique name of object you want to delete.

MODIFY

Modifies any variable (property) of an object. It is followed by a type of object and a list of variables and values you want to assign to these variables.

DISPLAY

Displays any variable (property) of an object. It is followed by a type of object (domain, account or system) and a list of variables you want to show. Result is generated with double line feeds.

EXPORT

Does the same as DISPLAY command but this command shows on the screen everything separated by comma (CSV format). Result is generated without double line feeds.

FILE

Calls file functions. It is followed by USERSTATISTICS and all its parameters (see below).

Parameter

Description

ACCOUNT [variables]

Address any account on the server.

DOMAIN [variables]

Address any domain on the server.

SYSTEM [variables]

Address any system variable such as c_version, c_name, etc. List is also in APIConst.pas

BATCH batchfile

Allows you to run a batch file with a set of commands included. See examples below.

Batchfile is just a common text file with commands. Each on a separate line. These commands must not include "tool" at the beginning. Just the commands and parameters.

USERSTATISTICS fromdate todate filterstring outputfile

Saves userstatistics between fromdate and todate to specified output file for all users that fulfill the condition of filterstring.

fromdate,todate have yyyy/mm/dd format

filterstring supports also asterisks and question marks to specify more accounts. If it does not contain @ symbol it is considered as domain name.

outputfile If you do not specify absolute path, it will be saved to <InstallDirectory> folder.

How to create other types of accounts

To do this, you have to use u_type property. Its values are also written in APIConst.pas file. For example mailing list has 1 as a value of this property. So if I want to create mailing list I will have to use this:

tool create account mailing@icewarpdemo.com u_type 1 m_owneraddress "admin@icewarpdemo.com"

Usage

tool create account new@icewarpdemo.com u_name "New Account" u_password "pass" u_accounttype 2

tool display account new@icewarpdemo.com u_mailbox u_accounttype

tool delete domain oldone.net

tool modify account *@icewarpdemo.com u_accounttype 2

tool file userstatistics 2004/12/25 2004/12/31 icewarpdemo.com statistics.txt

tool export domain * d_description d_postmaster

tool export account *@* u_mailbox u_name u_password > accounts.txt

tool import account contas.txt u_name u_password

note_small

NOTE: The first field imported from this CSV file is an email address – it is imported automatically and is not to be written in the import command. It has to be specified in CSV in the first place.

tool display system c_config_services_pop3_port

tool file batch create_mailing.txt

tool check account *@* passpolicy

tool check account *@* passpolicy > <filename>

tool display account @*@ > accounts.txt

tool export account *@* > accounts.txt