-
Notifications
You must be signed in to change notification settings - Fork 8
/
run.pl
executable file
·45 lines (40 loc) · 946 Bytes
/
run.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env perl
use File::Basename;
use Getopt::Long;
BEGIN { unshift @INC, '.'; unshift @INC, '../../src/test/perl' }
use Cluster;
my $n_nodes = 3;
my $referee = 0;
my $action = 'start';
GetOptions ("nnodes=i" => \$n_nodes, # numeric
"referee" => \$referee, # flag
"action=s" => \$action); # strings
# referee works only with 2 nodes
if ($referee)
{
$n_nodes = 2;
}
if ($action eq "start")
{
$Cluster::last_port_assigned = 65431;
my $cluster = new Cluster($n_nodes, $referee);
$cluster->init();
$cluster->start();
$cluster->create_mm('regression');
# prevent PostgresNode.pm from shutting down nodes on exit in END {}
@PostgresNode::all_nodes = ();
}
elsif ($action eq "stop")
{
my @datas = <$TestLib::tmp_check/*data>;
foreach my $data (@datas) {
TestLib::system_log('pg_ctl',
'-D', "$data/pgdata",
'-m', 'fast',
'stop');
}
}
else
{
die("Usage: run.pl action=<start|stop> [opts]\n");
}