Skip to content

Script Console

Execution modes

Script Console is a runtime environment that features different execution modes (a shell, a script interpreter and a lightweight webserver) therefore it's the perfect solution when it comes to integrate Content Server with external systems. The simplest way to use the Script Console is to start it as a command line shell.

Script Console can run under both a Windows system and a Unix system, being based on a modular Java-based architecture. The main scripts for both the supported platforms are located under the “bin” directory in the runtime installation directory.

Command Line Shell Mode

In order to start the Script Console as a command line shell you have to execute the following command

Without any additional parameter. The system should respond you with the Script Console prompt (as shown in the figure below)

The prompt indicates the current system and its connection status. In the case of the figure above the current system has been labeled “TEST” and is currently off-line. New system can be added using the main configuration file of the Script Console. When newly installed a “TEST” system configuration is made available for future references.

An online help about the supported commands is available directly from the Script Console shell. Here below the list of all the commands available out-of-the-box:

loadcs

usage: loadcs -i 00000

Load a Content Script from a file or from Content Server

-e,--encoding <arg> The file encoding (platform default if not

specified)

-f,--file <arg> The local file to load as a script

-h,--help This help message

-i,--id <arg> The ID of the target script on the system

memsrc

usage: memsrc -g "MyGroup"

Search members

-@,--col-email COLUMN: Mail address

-a,--all Use a long listing format for results

-c,--match-contains MATCHING: Contains

-e,--match-endswith MATCHING: Ends with

-f,--col-first-name COLUMN: First name

-g,--filter-groups FILTER: Search only groups

-h,--help This help message

-k,--match-like MATCHING: Sounds like

-l,--col-last-name COLUMN: Last name

-m,--filter-members FILTER: Search any member

-n,--col-name COLUMN: Name

-s,--match-startswith MATCHING: Starts with

-u,--filter-users FILTER: Search only users

ls

usage: ls

List the children of the current node

-h,--help This help message

-l,--long Use a long listing format

rm

usage: rm "Node to delete" "Another node to delete"

Delete one or more nodes in the working node

-h,--help This help message

-i,--id Reference nodes by ID

-p,--parent <arg> Use specified parent in place of working node

-r,--regexp <arg> Match the node names to delete against the

specified regexp

mkdir

usage: mkdir "Folder Name"

Create a new folder

-h,--help This help message

-p,--parent <arg> The parent ID of the new folder

script

usage: script

Switch to scripting mode. In script mode you can write and save your one
script one line at a time

-h,--help This help message

quit | exit

Shutdown and exit

whoami

Information about the current user

loaddocs

usage: loaddocs -d /home/user/myDocs -i -r .\*.pdf

Load documents on Content Server

-d,--directory <arg> The local directory to load files from

-h,--help This help message

-i,--interactive Prompt for confirmation for each file

-n,--name Prompt for a new name for each file

-p,--parent <arg> The target directory

-s,--suffix <arg> Match the node names to delete with the

specified suffix

system

usage: system -options

List systems or switch the current system

-a,--add <arg> Add a new system

-c,--current The current system details

-h,--help This help message

-l,--list List all the available systems

-s,--system <arg> Switch to the target system

pwd

Print the current working node

mkuser

usage: mkuser bob -p passwd1 -g "MyGroup, Developers"

Create a new user

-a Public access enabled

-c Can create and update users

-g Can create and update groups

-h,--help This help message

-l Login enabled

-p,--password <arg> The initial password

-s Can administer system

-u Can administer users

interactive

Switch to interactive console mode. In interactive mode you can enter
Content Script commands and execute them directly.

sync

usage: sync

Synchronized console command scripts

-c,--commit Commit modified local scripts to Content Server

-h,--help This help message

-n,--name <arg> The single command to sync

su

usage: su bob

Impersonate a different user

-h,--help This help message

-r,--restore Restore the original logged in user

login

usage: login -options

Login to the specified system

-h,--help This help message

-i,--interactive Force credential prompt (useful id there are

saved credentials)

-k,--save Save the provided credentials (Crypted)

-p,--password <arg> The user's password

-s,--system <arg> The system to connect to

-u,--username <arg> The username

cd

usage: cd -i 2000

Change the current working node

-c,--category Switch to category WS

-e,--enterprise Switch to enterprise WS

-h,--help This help message

-i,--id <arg> The ID of the target node

-n,--nickname <arg> The nickname of the target node

-p,--personal Switch to personal WS

logout

Logout from the current system

loadConfig

usage: loadConfig -v -m Mode

Loads the current system Base Configuration in the Script Console
Configuration

-h,--help Usage Information

-m,--mode <arg> Mode: either BASE, CUSTOM, ALL

-v,--verbose Verbose

Creating new command

New commands can be registered using Content Script to implement them. Script Console comes with a set of example commands implemented through Content Scripts that a developer can use as a reference to create his own.

Script Interpreter Mode

The Script Console can also be executed as a Script interpreter (in order to execute a specific Content Script) in this case the Console should be executed specifying both the script to be executed and the system to log in:

In order to be able to execute the Script Console with this Mode a valid user credentials should have been registered using the command:

login –k –i –s SYSTEM         

Server Mode

A third way the Script Console can be executed is a lightweight webserver. In this case the Console should be executed specifying both the port on which to listen for incoming connection and the system to log in:

In order to be able to execute the Script Console with this Mode a valid user credentials should have been registered using the command:

login –k –i –s SYSTEM         

Script repositories

The Script Console organizes the registered Content Script in isolated repositories. A Script repository might be dedicated to a specific system (in this case the Scripts stored in this repository will be loaded and made available only when the user decides to login to that system), or to a specific extension.

Script Console extensions’ script are made available through all the configured systems.

Script Console features a synchronization command (synch), that can be used, both when the Console is running as a shell as well as when the console is running as a web server, in order to synchronize system repository with the content of the corresponding CSCommands Template folder in the Content Script Volume of the current system.

Script Console Internal scheduler configuration file

The Script Console features an internal scheduler configurable through another XML configuration file (cs-console-schedulerConfiguration.xml) that is also stored under the config directory.

The internal scheduler allows to plan and execute tasks to be automatically run in the Script Console. It is based on Quartz open source library (a well-known Java Scheduler). For further information please make reference directly to the Quartz documentation http://quartz-scheduler.org/ .