10- CLI(Command Line Interface) Example

MCCS CLI is the function to send a command to the MCCS service in the system's command window mode.
MCCS provides the following types of CLI: mclog to add arbitrary log, mcgroup to command a group, and mcres to command the resource group.
In general, CLI prepares scripts (*.sh and etc) to send various commands to the MCCS service.
CLI is located in $MCCS_HOME\bin.

After registering script file in PowerLinux MCCS and use CLI command, FullPath($MCCS_HOME/bin/mclog) must be used.

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 script with MCCS CLI

Create CLITestGroup

Create CLITestGroup
#!/bin/bash
# Create a new group
mclog="$MCCS_HOME/bin/mclog"
mcgroup="$MCCS_HOME/bin/mcgroup"
$mclog -n 192.168.100.2 -p 4321 -s CLITestGroup -l INFO -m "Start CLI Test Code."

end
{
	$mclog -n 192.168.100.2 -p 4321 -s CLITestGroup -l INFO -m "Stop CLI Test Code"
}
$mcgroup -state CLITestGroup
if [ $? -ne 0 ]
then
	end
fi
# Create CLITestGroup.
$mclog -n 192.168.100.2 -p 4321 -s CLITestGroup -l INFO -m "Creat new group since CLITestGroup does not exist."
$mcgroup -add CLITestGroup
$mcgroup -modify CLITestGroup -a TargetNodeList Beta,Alpha
$mclog -n 192.168.100.2 -p 4321 -s CLITestGroup -l INFO -m "CLITestGroup is created"

Create and Online CLITestProcess in CLITestGroup

Create and Online CLITestProcess in CLITestGroup
#/bin/bash
# CLITestProcess를 시작합니다. 
mclog="$MCCS_HOME/bin/mclog" 
mcres="$MCCS_HOME/bin/mcres" 

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

#  Test if CLITestProcess exist
$mcres -list CLITestProcess
if [ $? -ne 0 ]
then
	end 
else
	cliTestProcessCreat
fi

cliTestProcessCreat
{
	# 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 -add CLITestProcess -t Process -g CLITestGroup 
	$mcres -modify CLITestProcess -a Path /usr/local/testprocess
	$mcres -modify CLITestProcess -a InteractWithDesktop true
	$mcres -enable CLITestProcess
	$mcres -online CLITestProcess -n Beta
}
end
{
	# 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"
}