/usr/bin/slonik_subscribe_set is in slony1-2-bin 2.2.6-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #!/usr/bin/perl
#
# Author: Christopher Browne
# Copyright 2004-2009 Afilias Canada
use Getopt::Long;
# Defaults
$CONFIG_FILE = '/etc/slony1/slon_tools.conf';
$SHOW_USAGE = 0;
# Read command-line options
GetOptions("config=s" => \$CONFIG_FILE,
"help" => \$SHOW_USAGE);
my $USAGE =
"Usage: subscribe_set [--config file] set# node#
Begins replicating a set to the specified node.
";
if ($SHOW_USAGE) {
print $USAGE;
exit 0;
}
require '/usr/share/slony1/slon-tools.pm';
require $CONFIG_FILE;
my ($set, $node) = @ARGV;
if ($node =~ /^(?:node)?(\d+)$/) {
$node = $1;
} else {
print "Need to specify node!\n";
die $USAGE;
}
die $USAGE unless $set;
$set = get_set($set) or die "Non-existent set specified.\n";
my $slonik = '';
$slonik .= genheader();
$slonik .= " \n";
if ($DSN[$node]) {
my $provider = $SET_ORIGIN;
my $forward;
if ($PARENT[$node]) {
$provider = $PARENT[$node];
}
if ($NOFORWARD[$node] eq "yes") {
$forward = "no";
} else {
$forward = "yes";
}
$slonik .= " subscribe set (id = $set, provider = $provider, receiver = $node, forward = $forward);\n";
} else {
die "Node $node not found\n";
}
$slonik .= " echo 'Subscribed nodes to set $set';\n";
run_slonik_script($slonik);
|