70 lines
1.6 KiB
Plaintext
70 lines
1.6 KiB
Plaintext
|
#!/usr/bin/env perl
|
||
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||
|
|
||
|
use Getopt::Long;
|
||
|
|
||
|
#################################################################
|
||
|
# This script is used for RMC node configuration
|
||
|
##################################################################
|
||
|
sub usage
|
||
|
{
|
||
|
my %rsp;
|
||
|
print "Usage:
|
||
|
configrmcnode -a node_name ms_name ms_ip_addresses ms_node_id
|
||
|
configrmcnode -d node_name
|
||
|
";
|
||
|
}
|
||
|
|
||
|
print "configrmcnode get called\n";
|
||
|
if (!GetOptions(
|
||
|
'a' => \$::ADD,
|
||
|
'd' => \$::DELETE,)) {
|
||
|
&usage;
|
||
|
exit 1;
|
||
|
}
|
||
|
|
||
|
if ($::ADD) {
|
||
|
if (@ARGV < 4) {
|
||
|
&usage;
|
||
|
exit 1;
|
||
|
}
|
||
|
|
||
|
#check if rsct is installed and running
|
||
|
if (! -e "/usr/bin/lsrsrc") {
|
||
|
print "RSCT is not is not installed.\n";
|
||
|
exit 1;
|
||
|
}
|
||
|
my $result=`/usr/bin/lssrc -s ctrmc`;
|
||
|
if ($result !~ /active/) {
|
||
|
#restart rmc daemon
|
||
|
$result=`startsrc -s ctrmc`;
|
||
|
if ($?) {
|
||
|
print "rmc deamon cannot be started\n";
|
||
|
exit 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#enable remote client connection
|
||
|
`/usr/bin/rmcctrl -p; /usr/bin/refrsrc IBM.MCP`;
|
||
|
|
||
|
#define resource in IBM.MCP class on node
|
||
|
$result=`/usr/bin/mkrsrc-api IBM.MCP::MNName::"$ARGV[0]"::KeyToken::"$ARGV[1]"::IPAddresses::"$ARGV[2]"::NodeID::$ARGV[3]`;
|
||
|
print "define resource in IBM.MCP class result=$result\n";
|
||
|
|
||
|
exit 0
|
||
|
}
|
||
|
|
||
|
if ($::DELETE) {
|
||
|
if (@ARGV < 1) {
|
||
|
&usage;
|
||
|
exit 1;
|
||
|
}
|
||
|
|
||
|
#remove resource in IBM.MCP class on the node
|
||
|
my $result= `/usr/bin/rmrsrc-api -s IBM.MCP::"MNName=\\\"\"$ARGV[0]\\\"\""`;
|
||
|
print "remove resource in IBM.MCP class result=$result\n";
|
||
|
|
||
|
exit 0;
|
||
|
}
|
||
|
|