Command reference

Overview

The client utilities described below can be run from the command-line prompt in the operating system. They check EMGDIR/client.cfg for information about host, port, username and password. If all or part of this information is missing from the configuration file it has to be specified on the command-line.

All command utilities display help information when executed with “-help” as argument.

# emgsend -help

The utilities will return exit codes as follows:

Exit codeDescription
0Successful
1Missing username or password
2Server host or port missing
3Not possible to connect to the server
4Invalid argument
5Access denied

In your shell you can display the exit code by running “echo $?” after executing a command. Example:

# emgsend 12345 "Test"
758901
# echo $?
0

emgclient

Interactive utility that enables a user to operate on messages, display queues and more. It uses the MGP protocol to communicate with the server. To be able to perform all available tasks and display all queue and orphan entries the user needs to be defined as an administrator.

You can use “help” to display available operations in the current context.

Options

OptionDescription
–host <host name | IP address>Use specified hostname when connecting to server
–port <port number>Use specified port when connecting to server
–username <username>Username for server authentication
–password <password>Password for server authentication

emgd

The EMG server.

Options

OptionDescription
–debugSet log level to DEBUG and display information on stdout.
–exportxmlExport contents of embedded database into XML file, emg.xml.
–fgRun in foreground, do not detach from tty.
–hostidDisplay hostid as emgd reads it.
–importxmlImport contents from XML file, emg.xml, into embedded database.
–refreshRefresh running server. Will close all open sessions.
–reloadRefresh running server without closing current sessions.
–stopStop running server.
–threadcountCount the number of threads can can be created. This gives a hint on the total maximum number of instances the EMG server can handle since each connector instance requires 1 or 2 threads depending on protocol used.
–upgradedbUpgrade the database schema. If the number of records are large this may take several hours when altering existing tables.
–upgradesqlPrint the SQL commands that would be executed to upgrade the database schema without actually executing them.
-vDisplay version and license information.
–verifyParse the configuration file and report found configuration errors (without starting the server).

Example:

# emgd --hostid

emgload

Used for load testing and benchmarks. Acts as a message load generator.

emgsend

Used to send messages using the MGP protocol.

By default the newly assigned message id is displayed when the message has been successfully sent to the server.

Options

OptionDescription
–host <host name | IP address>Use specified hostname when connecting to server
–port <port number>Use specified port when connecting to server
–username <username>Username for server authentication
–password <password>Password for server authentication
-b <filename>Read recipients from the specified file. Format of file is one recipient per line.
–file <filename>Read the message body from the specified file.
–hexMessage is hex encoded.
-oSpecify message options.
-qDo not display message id.
–urlURL to use for HTTP based protocols.

Examples

# emgsend 4670123456 "Test message"
# emgsend -hex 4670123456 414243
# emgsend -o ROUTE=cimd2-1 -o SOURCEADDR=sender 4670123456 "Test message"

emgsink

Used for load testing and benchmarks. Acts as a message sink.

emgstat

Display information about connectors and connector states.

Options

OptionDescription
–host <host name | IP address>Use specified hostname when connecting to server
–port <port number>Use specified port when connecting to server
–username <username>Username for server authentication
–password <password>Password for server authentication
–dbShow database instance information
-xDisplay detailed connector instance information.

Output description

ColumnDescription
NAMEConnector name
INDEXConnector index or position server.cfg file
TYPEIN for incoming, OUT for outgoing connector
PROTOProtocol
INSTNumber of instances
USEDMaximum number of instances that is or has been in use since system start
STATEConnector state
QSIZEConnector queue size. If connector has a configured max queue size it will be appended as a suffix, for example “3/100”
AVG 1MNumber of messages per sec processed during the last minute
AVG 5MNumber of messages per sec processed during the last 5 minutes
AVG 15MNumber of messages per sec processed during the last 15 minutes

Example

# emgstat
NAME          INDEX TYPE PROTO INST USED STATE  QSIZE  AVG 1M  AVG 5M AVG 15M
mgp-in1           0 IN   MGP      1 1 BOUND      0 0.00 0.00 0.00
smpp-in1          1 IN   SMPP     7 1 BOUND      0 0.00 0.00 0.00
smtp1             2 OUT  SMTP     0 0 DEAD       0 0.00 0.00 0.00
ucp-andrew        3 OUT  UCP      1 0 IDLE       0 0.00 0.00 0.00
ucp-d2            4 OUT  UCP      1 0 IDLE       0 0.00 0.00 0.00
cimd2-euro        5 OUT  CIMD2    1 0 IDLE       0 0.01 0.01 0.00