10. CLI(Command Line Interface) Example.

MCCS CLI is a function that provides the command from command prompt of Window OS to MCCS service.
Types of CLI that MCCS provides are mclog.exe (add logs arbitrarily in MCCS log), mrgroup.exe (send command to MCCS group) and mcres.exe (send commands to MCCS resources).
In general, CLI is used to write script(*.bat, *.cmd) file and send commands to MCCS service.
MCCS CLI exists in '%MCCS_HOME%\bin' directory. 

 

Table of Contents

When you install MCCS, the initial user account ID is set to 'admin' and the password is set to 'password'.
When you run the CLI command, you need to enter the ID and the password. Otherwise, the above initial ID and password will be used.
Thus, when you change the initial user password, you must enter the ID/password in the CLI command as options.

Examples of Batch script with MCCS CLI

Create CLITestGroup

Create CLITestGroup
@echo on 
@echo ### Create a new group
set mclog="%MCCS_HOME%\bin\mclog.exe" 
set mcgroup="%MCCS_HOME%\bin\mcgroup.exe" 
%mclog% -n 192.168.100.2 -p 4321 -s CLITestGroup -l INFO -m "Start CLI Test Code." 

%mcgroup% -state CLITestGroup 
if not errorlevel 1 goto end 

@echo ### Create CLITestGroup.
%mclog% -n 192.168.100.2 -p 4321 -s CLITestGroup -l INFO -m "Creat new group since CLITestGroup does not exist." 
%mcgroup% -u admin -pw password -add CLITestGroup 
%mcgroup% -u admin -pw password -modify CLITestGroup -a TargetNodeList Beta,Alpha 
%mclog% -n 192.168.100.2 -p 4321 -s CLITestGroup -l INFO -m "CLITestGroup is created"  

:end
%mclog% -n 192.168.100.2 -p 4321 -s CLITestGroup -l INFO -m "Terminates CLI Test Node."

Create and Online CLITestProcess in group CLITestGroup

Create and Online CLITestProcess in group CLITestGroup
@echo on 
@echo ### Starts CLITestProcess. 
set mclog="%MCCS_HOME%\bin\mclog.exe" 
set mcres="%MCCS_HOME%\bin\mcres.exe" 

%mclog% -n 192.168.100.2 -p 4321 -s CLITestProcess -l INFO -m "Starts CLI Test Code." 

@echo ### Test if CLITestProcess exist
%mcres% -u admin -pw password -list CLITestProcess 
if not errorlevel 3 goto end 

:cliTestProcessCreat 
@echo ### CLITestProcess  After creating a resource, enable it.
%mclog% -n 192.168.100.2 -p 4321 -s CLITestProcess -l INFO -m "Create and cause CLITestProcess resource go online." 

%mcres% -u admin -pw password -add CLITestProcess -t Process -g CLITestGroup 
%mcres% -u admin -pw password -modify CLITestProcess -a Path c:\wordpad01.exe 
%mcres% -u admin -pw password -modify CLITestProcess -a InteractWithDesktop true 
%mcres% -u admin -pw password -enable CLITestProcess 
%mcres% -u admin -pw password -online CLITestProcess -n Beta 

:end 
@echo ### Monitors group state. 
%mclog% -n 192.168.100.2 -p 4321 -s CLITestGroup -l INFO -m "Terminates CLI Test Code."
mclog -n 192.168.100.2 -p 4321 -s cli -l ERROR -m "mclog test message"

 

Â