UNMS - CLI


Overview


In this article, we introduce some basic console commands that can be useful for solving UNMS related issues.


Table of Contents


  1. Introduction
  2. Restart UNMS
  3. Stop UNMS
  4. Start UNMS
  5. Set Superadmin
  6. Password recovery (0.14.0+)
  7. Password recovery (0.10.0 - 0.13.3)
  8. Refresh Let's Encrypt certificate
  9. Fix redis aof file
  10. Rewrite redis aof file
  11. Device update frequency
  12. Clear backups
  13. Restore UNMS from backup
  14. Worker count
  15. Whitelist
  16. Related Articles

Introduction


Back to Top

NOTE: This command will not remove your settings or data, but will log all users out of UNMS.

Below you will find some useful console commands for UNMS. If you need to reset the application or find out forgotten password you will find the right tool here.


Restart (0.10.0+)


Back to Top

Use the following command to rebuild all UNMS docker containers. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli restart

Stop (0.10.0+)


Back to Top

This command stops UNMS containers. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli stop

Start (0.10.0+)


Back to Top

This command starts UNMS containers. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli start

Set Superadmin (1.0.0+)


Back to Top

Super admin role is necessary for access to the CRM module. When it is necessary to set super admin from outside of UNMS GUI, this command is available

sudo ~unms/app/unms-cli set-superadmin --username <username>
NOTE: It is possible to use this command without the --username tag, to display the list of available users.

Password recovery (0.14.0+)


Back to Top

In version 0.14.0 we changed the password recovery to have the same format as the rest of UNMS CLI commands. To change a user's password, specify the username as a parameter and enter a new password when asked:

sudo ~unms/app/unms-cli set-password --username <username>

In case of any issues with two-factor authentication this command can be used to completely disable it:

sudo ~unms/app/unms-cli disable-two-factor --username <username>

Another new feature is the role of the super admin. When it is necessary to set super admin from outside of UNMS GUI, this command is available

sudo ~unms/app/unms-cli set-superadmin --username <username>
NOTE: It is possible to use all of the commands above without the --username tag, to display the list of users instead of changing their password or disabling 2FA for them.

Password recovery (0.10.0 - 0.13.3)


Back to Top

UNMS includes a script that can be used to change an existing user's password in case of password recovery be e-mail is unavailable. To see the list of existing users in UNMS, run the following command on the UNMS host machine:

sudo docker exec -ti unms ./setpwd.sh

To change a user's password, specify the username as a parameter and enter a new password when asked:

sudo docker exec -ti unms ./setpwd.sh <username>
NOTE: Changing the password this way turns off two-factor authentication. You can turn it on again after logging in.

Refresh Let's Encrypt certificate (0.12.0+)


Back to Top

This command refresh Let's Encrypt certificate. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli refresh-certificate

Fix redis aof file (0.12.0+)


Back to Top

This command fixes corrupted redis aof file, which can be located here /home/unms/data/redis/appendonly.aof. Run as a user with sudo enabled.

sudo ~unms/app/unms-cli stop
sudo ~unms/app/unms-cli fix-redis-aof
sudo ~unms/app/unms-cli start

Rewrite redis aof file (0.12.0+)


Back to Top

This command forces redis aof file to recalculate. Useful when the file is too big, you can check the size of this file here /home/unms/data/redis/appendonly.aof. Run as a user with sudo enabled. UNMS has to be running in order for this command to work. Also, please note that you will need a lot of free space on your disc to complete this process. We recommend you to delete some older logs to create enough space.

sudo ~unms/app/unms-cli rewrite-redis-aof

Reduce device update frequency (0.12.1-rc.2+)


Back to Top

This command reduces the UNMS device update frequency. It's helpful when UNMS is overloaded and it's not possible login to UNMS UI.

sudo ~unms/app/unms-cli reduce-device-update-frequency

Clear device backups (0.13.0+)


Back to Top

Use the following command when you are running out of the disc space because of a large volume of device backups.

sudo ~unms/app/unms-cli clear-device-backups

Restore UNMS from backup (0.14.0+)


Back to Top

Use the following command to restore UNMS from a selected backup file.

unms-cli restore-backup --file <backup-file>
NOTE: When this CLI command is used without the --file tag, then the latest automatic backup is automatically selected.

Worker count (0.13.0+)


Back to Top

ATTENTION: The 'COUNT' value should not be higher than the actual number of available CPU cores. It is possible to set this value to 'auto' in order to let UNMS decide how many workers it needs. Please have at least 0,5 Gb of free RAM free for each worker.

If you need to utilize your multicore processor to its maximum you can set the number of worker processes which are managing device connections.

sudo ~unms/app/unms-cli set-workers COUNT

Whitelist of IP addresses for GUI/API (0.14.0+)


Back to Top

NOTE: This only limits the access to GUI/API. All devices can still connect to UNMS server from any IP address, and this whitelist doesn't affect that connection at all.

Use the following command when you want to manage the whitelist of IP addresses that are allowed to access UNMS GUI/API.

  • Show current whitelist
    sudo ~unms/app/unms-cli ip-whitelist --show
    
  • Create a new whitelist
    sudo ~unms/app/unms-cli ip-whitelist --set "193.86.83.186,ff::ff/25"
    
  • Clear the whitelist to allow access from all addresses
    sudo ~unms/app/unms-cli ip-whitelist --clear
    

Related Articles


Back to Top

UNMS - How to restart UNMS


 

We're sorry to hear that!