Table of Contents
< All Topics
Print

GnosisCMD CLI

The Gnosis Command Line Tool, GnosisCMD, can perform service and internal tasks using a command line interface.

The GnosisCMD Command Line Tool can create, upgrade, shrink, backup, restore, and delete the Gnosis database, view or set system configuration settings, install and uninstall Gnosis Application Modules, import or export Solutions, create user accounts, clear system logs, execute Gnosis Scripts (*.gs) and Gnosis batches (*.gcmd), schedule background tasks, and send service signals to all other Gnosis tasks (e.g., refresh-tasks, refresh-config, stop-tasks, restart-server).

GnosisCMD command line options

All the commands can use the following special parameters:

  • $settings: string (optional) – can be specified to use custom settings.config file.
  • user: string (optional) can be specified to work on behalf of a certain user.

Upgrade

Upgrade the Gnosis Database to the current Gnosis Platform version. This command is also used for database creation.

GnosisCmd.exe upgrade 
  [hardfix=false]
  • hardfix: Boolean (optional) – if true, rebuild base Items and reindex collections.

Config

Set Configuration setting or file.

GnosisCmd.exe config key 
  [value='value'] 
  [resource='file.gs|*.png'] 
  [,recursive=false] 
  [,onlyAccessible=false] 
  [,default=false]
  • key: string – configuration key to get/set (e.g. Backup/Mode). Can be wildcard ‘*’ in get mode to get all existing keys. In case of setting a resource file, the key represents folder name in resource storage.
  • value: string (optional) – the value for the key to set/update.
  • resource: string (optional) – the path to a file or multiple files to upload to resource storage (e.g. filename.txt or directory/*.png).
  • recursive: boolean (optional) – if true, then file mask from resource is applied recursively for all nested directories.
  • onlyAccessible: boolean (optional) – if true, then all inaccessible files in resource storage for the current user are ignored (e.g. admin folder is accessible to admins only).
  • default: boolean (optional) – if true, then the value is set only if it was not set yet.

Install

Install a Gnosis App Module.

GnosisCmd.exe install package.app|dir
  • package.app|dir: string – the package app file or directory.

Uninstall

Uninstall a Gnosis App Module.

GnosisCmd.exe uninstall moduleId
  • moduleId: string – the module ID.

Import

Import exported Gnosis Package from a Zip file or directory.

GnosisCmd.exe import package.zip|dir 
  [update=false] 
  [,recover=false] 
  [,path='']
  • package.zip|dir: string – the package zip file or directory.
  • update: boolean (optional) – if true, the import works in update mode, otherwise all solutions in the package are assumed to not exist in the database.
  • recover: boolean (optional) – if true, the import process attempts to recover inconsistent data (e.g. all non-existing user references are replaced by the current user, all invalid items are ignored).
  • path: string (optional) – the path inside a zip file to import from.

Import-patch

Import exported Gnosis History Patch.

GnosisCmd.exe import-patch package.zip|dir
  • package.zip|dir: string – the package zip file or directory exported from App History.

Create-user

Create a new User Account.

GnosisCmd.exe create-user email firstName lastName 
  [password=''] 
  [,prop1=val1]
  • email: string – the unique email address for the user account.
  • firstName: string – the first name for the new user account.
  • lastName: string – the last name for the new user account.
  • password: string (optional) – if empty, an auto-generated password is created.
  • PhoneNumber: string (optional)
  • Language: string (optional)
  • TimeZone: string (optional)
  • prop1: any other custom setting that can be used by the App.

Import-users

Create user accounts from exported XML file.

GnosisCmd.exe import-users users.xml 
  [update=false]
  • users.xml: string – path to the exported XML file with user accounts.
  • update: boolean (optional) – if true, update the existing user accounts.

Import-teams

Create Teams from exported XML file.

GnosisCmd.exe import-teams teams.xml
  • teams.xml: string – path to the exported XML file with teams.

Import-data

Import item data using the specified Solution Item Type View.

GnosisCmd.exe import-data solution.itemType.viewName dataFile 
  [prop1=val1]
  • solution.itemType.viewName: string – the full View name of the Import View.
  • dataFile: string – the path to the data file (e.g. xlsx, json).
  • prop1: (optional) – additional parameter used by Import View.

Backup

Backup the Gnosis Databases.

GnosisCmd.exe backup toDir 
  [mode=full|minimal]
  • toDir: string – the path to the directory to put the backup files.
  • mode: string (optional) – if full, the entire database is backed up; minimal mode can be used to reduce backup size, however the restore time is increased then.

Restore

Restore the Gnosis Databases.

GnosisCmd.exe restore fromDir|fromArchive.zip 
  [force=false] 
  [,partial=false]
  • fromDir|fromArchive.zip: string – the path to the backup directory or Zip file name.
  • force: boolean (optional) – if true, all existing database connections are closed to perform the restore.
  • partial: boolean (optional) – if true, only existing files are used for restore (i.e. structure.bak to restore MS SQL database, items.bak to restore Mongo database).

Exec

Execute the Gnosis Script.

GnosisCmd.exe exec scriptFile.gs 
  [transaction=true] 
  [,simulate=false] 
  [,param1=val1]
  • scriptFile.gs: string – the path to the Gnosis Script file.
  • transaction: boolean (optional) – if false, then the script is executed in read-only mode.
  • simulate: boolean (optional) – if true, the script is running in simulating mode, and no changes are applied.
  • param1: (optional) – any input parameter used by the script.

Batch

Execute the Gnosis batch file.

GnosisCmd.exe batch batchFile.gcmd 
  [param1=val1] 
  [,param2=val2]
  • batchFile.gcmd: string – the path to the batch file.
  • param1: (optional) – any input parameter used by the batch script.

Add-task

Schedule a background task.

GnosisCmd.exe add-task command 
  [name=''] 
  [,priority=0] 
  [,at=Date()] 
  [,paused=false] 
  [,callback=script] 
  [,prop1=val1]
  • command: string – the Gnosis Script command name (can be one of built-in commands, or Gnosis Script command from commands folder in resource storage, or Solution.View to execute Task View).
  • name: string (optional) – a name for the background task.
  • priority: integer (optional) – the higher the number, the greater the priority of the task.
  • paused: boolean (optional) – if true, create the task in paused state.
  • callback: string (optional) – Gnosis Script executed after the task completes.
  • prop1: (optional) – any input parameter used by the task command processor.

Tasks

Get the tasks filtered by task properties.

GnosisCmd.exe tasks 
  [period=''] 
  [,command=''] 
  [,name=''] 
  [,status=''] 
  [,userName=''] 
  [,skipCallbacks=false] 
  [,limit=25]
  • period: double (optional) – the number of days since now.
  • command: string (optional) – the task command name (or part of the name).
  • name: string (optional) – the task name when it was created (or the part of the name).
  • status: string (optional) – a comma-delimited list of status names.
  • skipCallbacks: boolean (optional) – if true, skip task callbacks.
  • limit: integer (optional) – limit the number of tasks returned (25 by default).

Modules

Get the installed Gnosis Modules. Can be used to get list of installed modules with their IDs (e.g. to uninstall a module by ID).

GnosisCmd.exe modules

Solutions

Get all Gnosis Solutions (installed and created).

GnosisCmd.exe solutions

Types

Get all Item Types for the specified Solution.

GnosisCmd.exe types solution
  • solution: string – the Solution name or ID.

Dump

Dump the Gnosis Solution Items.

GnosisCmd.exe dump solution[.itemType] 
  [search=''] 
  [,sortBy=''] 
  [,groupBy=''] 
  [,start=0] 
  [,count=-1] 
  [,includeArchived=false] 
  [,propnames=''] 
  [,failOnError=false]
  • solution[.itemType]: string – the Solution name or Solution.Item Type path.
  • search: string (optional) – query string to filter the Items (using Search Query Syntax).
  • sortBy: string (optional) – comma or semi-colon delimited string of property names. If the property name starts with ‘!’ then the order is descending.
  • groupBy: string (optional) – comma or semi-colon delimited string of property names with optional aggregation functions. Aggregation function name follows the property name and is delimited by a dollar sign (Field$Function). Functions: Avg, Count, First, Last, Max, Min, Sum.
  • start: integer (optional) – set the starting position to return items.
  • count: integer (optional) – the number of items to return.
  • includeArchived: boolean (optional) – if true, include archived items in the results.
  • propnames: string (optional) – a comma-delimited list of Property names (or queries) to return.
  • failOnError: boolean (optional) – if true, terminate the query if there is an error.

Parse

Parse the Gnosis Script file and output it back.

GnosisCmd.exe parse scriptFile.gs 
  [ast=false]
  • scriptFile.gs: string – the path to the Gnosis Script file.
  • ast: boolean (optional) – if true, the AST of the script expression is printed in JSON form, otherwise AST is serialized back to script and printed in textual form.

Export

Export the Gnosis Solution to a package Zip file.

GnosisCmd.exe export solution package.zip 
  [mode=all|structure|data|lovs|structureandlovs] 
  [,recover=false]
  • solution: string – the Gnosis Solution name.
  • package.zip: string – the package Zip file name.
  • mode: string (optional) – all = the entire Solution; structure = the Solution meta files; data = just the Items data; lovs = the List of Value Items; structureandlovs = the meta files and List of Value Items.
  • recover: boolean (optional) – if true, then skip-broken items if any.

Export-all

Export all Gnosis Solutions to a package Zip file.

GnosisCmd.exe export-all package.zip 
  [mode=all|structure|data|lovs|structureandlovs] 
  [,recover=false] 
  [,includeInstalled=false]
  • package.zip: string – the package Zip file name.
  • mode: string (optional) – all = the entire Solution; structure = the Solution meta files; data = just the Items data; lovs = the List of Value Items; structureandlovs = the meta files and List of Value Items.
  • recover: boolean (optional) – if true, then skip-broken items if any.
  • includeInstalled: boolean (optional) – if true, include solutions from installed modules.

Move-type

Relocate an Item Type to another Solution.

GnosisCmd.exe move-type solution.itemType toSolution
  • solution.itemType: string – the Gnosis Solution Item Type path.
  • toSolution: string – the target Solution name.

Delete-solution

Delete the Solution.

GnosisCmd.exe delete-solution solution
  • solution: string – the Gnosis Solution name.

Clear-errors

Clear the Error Logs.

GnosisCmd.exe clear-errors

Clear-logs

Clear the Security Logs.

GnosisCmd.exe clear-logs

Clear-tasks

Clear tasks before a specified date.

GnosisCmd.exe clear-tasks 
  [mode=all|results] 
  [,before=date]
  • mode: string (optional) – all = all tasks; results = only tasks results.
  • before: date (optional) – clear tasks before the specified date.

Shrinkdb

Attempt to shrink database size.

GnosisCmd.exe shrinkdb 
  [deep=false]
  • deep: boolean (optional) – if true, shrink database log file as well.

Drop

Drop database (dangerous).

GnosisCmd.exe drop

Refresh-config

Notify tasks service to refresh configuration

GnosisCmd.exe refresh-config

Refresh-tasks

Notify tasks service to monitor/refresh the tasks queue.

GnosisCmd.exe refresh-tasks

Stop-tasks

Notify tasks service to stop executing background tasks.

GnosisCmd.exe stop-tasks 
  [gracefully=false] 
  [,all=false] 
  [,wait=false]
  • gracefully: boolean (optional) – if true, instruct service to wait for executing tasks before exit; otherwise, all executing tasks will be stopped and failed.
  • all: boolean (optional) – if true, stop all the task services; otherwise, stop only the corresponding task service.
  • wait: boolean (optional) – if true, wait until tasks service(s) shut down.

Restart-server

Notify the web server instance to restart.

GnosisCmd.exe restart-server

Version

Show the current Gnosis Platform version.

GnosisCmd.exe version