git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14563 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
		
			
				
	
	
		
			45 lines
		
	
	
		
			972 B
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			972 B
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env perl
 | 
						|
# IBM(c) 2012 EPL license http://www.eclipse.org/legal/epl-v10.html
 | 
						|
 | 
						|
BEGIN
 | 
						|
{
 | 
						|
    $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
 | 
						|
}
 | 
						|
 | 
						|
use lib "$::XCATROOT/lib/perl";
 | 
						|
use Getopt::Long;
 | 
						|
use xCAT::RShellAPI;
 | 
						|
 | 
						|
Getopt::Long::Configure("require_order");
 | 
						|
Getopt::Long::Configure("no_pass_through");
 | 
						|
 | 
						|
my $username;
 | 
						|
my $passwd;
 | 
						|
my $telnet;
 | 
						|
my $help;
 | 
						|
my $verbose;
 | 
						|
 | 
						|
if (!GetOptions(
 | 
						|
  'l|loginname=s' => \$username,
 | 
						|
  'p|password=s' => \$passwd,
 | 
						|
  't|telnet' => \$telnet,  #use telnet, otherwise ssh
 | 
						|
  'h|help' => \$help,
 | 
						|
  'v|verbose'=> \$verbose,
 | 
						|
  ) || $help || scalar(@ARGV)<2 ) {
 | 
						|
  print "Usage: rshell_api [-v] [-t] [-l <user>] [-p <passwrd>] <node> <command>\n";
 | 
						|
  exit;
 | 
						|
}
 | 
						|
 | 
						|
my $node = $ARGV[0];
 | 
						|
 | 
						|
my $output =xCAT::RShellAPI::run_remote_shell_api($node, $username, $passwd, $telnet, $verbose, @ARGV[1 .. $#ARGV]); 
 | 
						|
my $rc=0;
 | 
						|
my $data;
 | 
						|
if ($output && (@$output > 1)) {
 | 
						|
    $rc=$output->[0];
 | 
						|
    $data=$output->[1];
 | 
						|
}
 | 
						|
 | 
						|
print "$data";
 | 
						|
exit $rc;
 |