Skip to main content

Server commands

UCS supports these shell commands

ucs-api

Runs the UCS API method.

ArgumentMeaning
-hhelp
-jall arguments are in JSON format
-fdo not require confirmation before running the
-dshow the output of the method even in case of successful call
-s filenamethe name of the file in which the output data of the method will be saved (can be used more than once)
methodthe name of the method to be called
[arg ...]individual method arguments (can be used multiple times)

# example listing users
ucs-api -f -d config.users.list

ucs-db-backup

Auxiliary script for performing regular daily backups of the database on the UCS server. The script is run every day at 0:01 using cron /etc/cron.d/ucs.

Settings are loaded from /etc/ucs/ucs.conf

The parameterDefault valueMeaning
DB_BACKUP_DIR/opt/backups/dbthe directory where DB backups are stored
DB_BACKUP_KEEP30number of days after which advances are rotated

ucs-db-dump

Script to back up the UCS database.

ArgumentMeaning
-hhelp
-cuse a configuration file other than /etc/ucs/ucs.conf
-xbackup only configuration
-dbackup only data (CDR, statistics, etc.)
[ucs.sql]the name of the file to which the backup will be made

# backup UCS settings and data to the ucs.sql file
ucs-db-dump

# backup settings to the config.sql file
ucs-db-dump -x config.sql

# data backup to data.sql file
ucs-db-dump -d data.sql

ucs-db-master-here

It sets the database as master (primary) on the given node in the cluster (server).

For UCS cluster installation only.

ucs-db-restore

Restores the database from a dump. The script stops UCS before DB recovery and starts UCS again after recovery. To perform the recovery, the startup must be confirmed by entering YES (in capital letters).

ArgumentMeaning
-hhelp
-Bdo not rename the original DB to ucs_YYYYMMDDTHHMMSS
[ucs.sql]the name of the file from which the database will be restored

# restore the UCS database from the ucs.sql file
ucs-db-restore

# restore the UCS database from the prod.sql file without leaving the original DB
ucs-db-restore -B prod.sql

ucs-db-slave-here

On the given node in the cluster (server), it synchronizes the database from the primary node.

For UCS cluster installation only.

ucs-delete-data

Deletes data (CDR, statistics, etc.) from the UCS database. To perform the recovery, the startup must be confirmed by entering YES I KNOW WHAT I AM DOING and then additionally confirm DELETE DATA (in capital letters).

ucs-factory-reset

Clears data settings (CDR, statistics, etc.) from the UCS database. To perform the recovery, the startup must be confirmed by entering YES I KNOW WHAT I AM DOING and then additionally confirm DELETE CONFIG AND DATA (in capital letters).

ucs-logrotate

Helper script for rotating UCS logs. The script names the file YYYY-MM-DD_file.log and then packages it using gzip. The script is run every day at 0:00 using cron /etc/cron.d/ucs.

Settings are loaded from /etc/ucs/ucs.conf

The parameterDefault valueMeaning
LOGDIR/var/log/ucsdirectory to which UCS logs
LOG_LOGROTATE_ADDthe names of other files to be rotated in the UCS log directory

ucs-operator-deploy

Installs the operator application according to the parameters in the /etc/ucs/operator directory. The existing operator application is backed up to /opt/backups/YYYY-MM-DD_HH-MM-SS_operator.tar.gz (date time is the moment the installation was started).

ArgumentMeaning
-hhelp
-fdo not require confirmation before starting the installation
-s operator.tar.gzsource file or URL from which to install
-c /etc/ucs/operator/deploy.yamlinstallation configuration file
[operator.tar.gz]source file or URL from which to install

ucs-psql

Starts the PostgreSQL shell according to the settings in /etc/ucs/ucs.conf

ucs-reload-plugin

Reloads the UCS plugin. If the plugin has not been uploaded yet, it will upload it for the first time.

ArgumentMeaning
pluginthe name of the plugin to be (re)loaded

# (re)load plugin /opt/ucs/server/plugins/zakaznik.py
ucs-reload-plugin customer

ucs-set-parameter

Sets the UCS configuration parameter.

ArgumentMeaning
-hhelp
-r file.txtload the parameter from the file
-fdo not require confirmation before setting the
-llists supported parameter names with description
keythe name of the parameter to be changed
[value]new parameter value

# change NTP server to IP 1.2.3.4
ucs-set-parameter NTP_SERVER 1.2.3.4

# change SSL certificate and key
ucs-set-parameter SSL_CRT -r ucs.crt
ucs-set-parameter SSL_KEY -r ucs.key