Server commands
UCS supports these shell commands
ucs-api
Runs the UCS API method.
Argument | Meaning |
---|---|
-h | help |
-j | all arguments are in JSON format |
-f | do not require confirmation before running the |
-d | show the output of the method even in case of successful call |
-s filename | the name of the file in which the output data of the method will be saved (can be used more than once) |
method | the 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 parameter | Default value | Meaning |
---|---|---|
DB_BACKUP_DIR | /opt/backups/db | the directory where DB backups are stored |
DB_BACKUP_KEEP | 30 | number of days after which advances are rotated |
ucs-db-dump
Script to back up the UCS database.
Argument | Meaning |
---|---|
-h | help |
-c | use a configuration file other than /etc/ucs/ucs.conf |
-x | backup only configuration |
-d | backup 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).
Argument | Meaning |
---|---|
-h | help |
-B | do 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 parameter | Default value | Meaning |
---|---|---|
LOGDIR | /var/log/ucs | directory to which UCS logs |
LOG_LOGROTATE_ADD | the 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).
Argument | Meaning |
---|---|
-h | help |
-f | do not require confirmation before starting the installation |
-s operator.tar.gz | source file or URL from which to install |
-c /etc/ucs/operator/deploy.yaml | installation 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.
Argument | Meaning |
---|---|
plugin | the 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.
Argument | Meaning |
---|---|
-h | help |
-r file.txt | load the parameter from the file |
-f | do not require confirmation before setting the |
-l | lists supported parameter names with description |
key | the 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