2008-09-15 18:17:36 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
#(C)IBM Corp
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
{
|
|
|
|
$::XCATROOT =
|
|
|
|
$ENV{'XCATROOT'} ? $ENV{'XCATROOT'}
|
|
|
|
: -d '/opt/xcat' ? '/opt/xcat'
|
|
|
|
: '/usr';
|
|
|
|
}
|
|
|
|
use lib "$::XCATROOT/lib/perl";
|
|
|
|
use Getopt::Long;
|
|
|
|
use File::Basename;
|
|
|
|
use xCAT::MsgUtils;
|
|
|
|
use xCAT::Utils;
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
=head1 startstopxcatd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stopstartxcatd - this routine is linked to by startxCAT and stopxCAT.
|
|
|
|
It runs on AIX. If the admin runs startxCAT, it will start
|
|
|
|
or restart the xcatd, if it is already running.
|
|
|
|
If the admin runs stopxCAT, it will stop the xcatd.
|
|
|
|
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Main
|
|
|
|
my $rc = 0;
|
|
|
|
my $cmd = basename($0);
|
|
|
|
if (!(xCAT::Utils->isAIX()))
|
|
|
|
{ # only runs on AIX
|
2009-03-02 16:04:09 +00:00
|
|
|
xCAT::MsgUtils->message("E", "This command should only be run on AIX.\n");
|
2008-09-15 18:17:36 +00:00
|
|
|
exit 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
&parse_args($cmd);
|
|
|
|
$rc = xCAT::Utils->runxcatd($cmd);
|
|
|
|
exit $rc;
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
=head3 parse_args
|
|
|
|
|
|
|
|
Parses for input
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
sub parse_args
|
|
|
|
{
|
|
|
|
my ($cmd) = @_;
|
|
|
|
my $msg;
|
|
|
|
my $usagemsg;
|
|
|
|
Getopt::Long::Configure("posix_default");
|
|
|
|
Getopt::Long::Configure("no_gnu_compat");
|
|
|
|
Getopt::Long::Configure("bundling");
|
|
|
|
if (
|
|
|
|
!GetOptions(
|
|
|
|
'h|help' => \$::HELP,
|
2009-03-02 16:04:09 +00:00
|
|
|
'r|reload' => \$::RELOAD,
|
2008-09-15 18:17:36 +00:00
|
|
|
'v|version' => \$::VERSION
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
2009-03-02 16:04:09 +00:00
|
|
|
{
|
|
|
|
if ($cmd eq "xcatstart") {
|
|
|
|
$usagemsg = "$cmd [-h|-v|-r]\n";
|
|
|
|
xCAT::MsgUtils->message("E", $usagemsg);
|
|
|
|
} else { #xcatstop
|
|
|
|
$usagemsg = "$cmd [-h|-v]\n";
|
|
|
|
xCAT::MsgUtils->message("E", $usagemsg);
|
|
|
|
}
|
2008-09-15 18:17:36 +00:00
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
if ($::HELP)
|
|
|
|
{
|
2009-03-02 16:04:09 +00:00
|
|
|
if ($cmd eq "xcatstart") {
|
|
|
|
$usagemsg = "$cmd [-h|-v|-r]\n";
|
|
|
|
xCAT::MsgUtils->message("I", $usagemsg);
|
|
|
|
} else { #xcatstop
|
|
|
|
$usagemsg = "$cmd [-h|-v]\n";
|
|
|
|
xCAT::MsgUtils->message("I", $usagemsg);
|
|
|
|
}
|
2008-09-15 18:17:36 +00:00
|
|
|
exit 0;
|
|
|
|
}
|
2009-03-02 16:04:09 +00:00
|
|
|
if ($::RELOAD)
|
|
|
|
{
|
|
|
|
$ENV{XCATRELOAD} = "yes";
|
|
|
|
}
|
2008-09-15 18:17:36 +00:00
|
|
|
if ($::VERSION)
|
|
|
|
{
|
|
|
|
my $version = xCAT::Utils->Version();
|
|
|
|
$version .="\n";
|
|
|
|
xCAT::MsgUtils->message("I", $version);
|
|
|
|
exit 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|