| 1 |
#!/usr/bin/env perl |
| 2 |
|
| 3 |
# Test purpose. Checking arguments only |
| 4 |
|
| 5 |
use strict; |
| 6 |
use warnings FATAL => 'all'; |
| 7 |
|
| 8 |
use Getopt::Long; |
| 9 |
|
| 10 |
my ( |
| 11 |
$command, $orig_master_host, $orig_master_ip, |
| 12 |
$orig_master_port, $orig_master_user, $orig_master_password, |
| 13 |
$new_master_host, $new_master_ip, $new_master_port, |
| 14 |
$new_master_user, $new_master_password |
| 15 |
); |
| 16 |
GetOptions( |
| 17 |
'command=s' => \$command, |
| 18 |
'orig_master_host=s' => \$orig_master_host, |
| 19 |
'orig_master_ip=s' => \$orig_master_ip, |
| 20 |
'orig_master_port=i' => \$orig_master_port, |
| 21 |
'orig_master_user=s' => \$orig_master_user, |
| 22 |
'orig_master_password=s' => \$orig_master_password, |
| 23 |
'new_master_host=s' => \$new_master_host, |
| 24 |
'new_master_ip=s' => \$new_master_ip, |
| 25 |
'new_master_port=i' => \$new_master_port, |
| 26 |
'new_master_user=s' => \$new_master_user, |
| 27 |
'new_master_password=s' => \$new_master_password, |
| 28 |
); |
| 29 |
|
| 30 |
exit &main(); |
| 31 |
|
| 32 |
sub main { |
| 33 |
if ( $command eq "stop" || $command eq "stopssh" ) { |
| 34 |
my $exit_code = 1; |
| 35 |
eval { |
| 36 |
$exit_code = 0; |
| 37 |
}; |
| 38 |
if ($@) { |
| 39 |
warn "Got Error: $@\n"; |
| 40 |
exit $exit_code; |
| 41 |
} |
| 42 |
exit $exit_code; |
| 43 |
} |
| 44 |
elsif ( $command eq "start" ) { |
| 45 |
my $exit_code = 10; |
| 46 |
eval { |
| 47 |
$exit_code = 0; |
| 48 |
}; |
| 49 |
if ($@) { |
| 50 |
warn $@; |
| 51 |
exit $exit_code; |
| 52 |
} |
| 53 |
exit $exit_code; |
| 54 |
} |
| 55 |
elsif ( $command eq "status" ) { |
| 56 |
exit 0; |
| 57 |
} |
| 58 |
else { |
| 59 |
exit 1; |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
|