/usr/bin/slony_show_configuration is in slony1-2-bin 2.2.5-2+b1.
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | #!/usr/bin/perl
#
# Author: Christopher Browne
# Copyright 2004-2009 Afilias Canada
# This script simply displays an overview of node configuration
# for a given SLONY node set
use Getopt::Long;
use Switch;
# 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: slony_show_configuration [--config file] [node# nodeproperty]
nodeproperty valid values:
host : return host
port : return connection port
user : return connection user
dbname : return connecton database name
noforward : return noforward configuration
parent : return parent node
dsn : return dsn connection string
cluster : return cluster name
node-config-file : return node config file name
node-config-file-quotemeta : retun quoted node config file name
config-file : return slon-tools config file name
config-file-quotemeta : retun quoted slon-tools config file name
";
if ($SHOW_USAGE) {
die $USAGE;
}
require '/usr/share/slony1/slon-tools.pm';
require $CONFIG_FILE;
if ( scalar(@ARGV) == 0 ) {
print_configurations();
} elsif ( scalar(@ARGV) == 2 ) {
$nodenum = $ARGV[0];
$nodeproperty = $ARGV[1];
if ($nodenum =~ /^(?:node)?(\d+)$/) {
$nodenum = $1;
}
print_property_value();
} else {
die $USAGE;
}
sub print_configurations {
print "Slony Configuration\n-------------------------------------\n";
if ($ENV{"SLONYNODES"}) {
print "With node configuration from ", $ENV{"SLONYNODES"}, "\n";
}
if ($ENV{"SLONYSET"}) {
print "With set configuration from ", $ENV{"SLONYSET"}, "\n";
}
print qq{
Slony-I Cluster: $CLUSTER_NAME
Logs stored under $LOGDIR
Slony Binaries in: /usr/bin
};
if ($APACHE_ROTATOR) {
print "Rotating logs using Apache Rotator: $APACHE_ROTATOR\n";
}
print qq{
Node information
--------------------------------
};
for $node (@NODES) {
printf("Node: %2d Host: %15s User: %8s Port: %4d Forwarding? %4s Parent: %2d Database: %10s\n DSN: %s\n",
$node, $HOST[$node], $USER[$node], $PORT[$node], $NOFORWARD[$node],
$PARENT[$node], $DBNAME[$node], $DSN[$node]);
}
}
sub print_property_value {
switch($nodeproperty) {
# connection configs
case "host" { print $HOST[$nodenum], "\n"; }
case "port" { print $PORT[$nodenum], "\n"; }
case "user" { print $USER[$nodenum], "\n"; }
case "dbname" { print $DBNAME[$nodenum], "\n"; }
case "dsn" { print $DSN[$nodenum], "\n"; }
# replication configs
case "parent" { print $PARENT[$nodenum], "\n"; }
case "noforward" { print $NOFORWARD[$nodenum], "\n"; }
# Misc
case "cluster" { print $CLUSTER_NAME, "\n"; }
# config files
case "node-config-file" { print $CONFIG[$nodenum], "\n"; }
case "node-config-file-quotemeta" { print quotemeta( $CONFIG[$nodenum] ), "\n"; }
case "config-file" { print $CONFIG_FILE, "\n"; }
case "config-file-quotemeta" { print quotemeta( $CONFIG_FILE ), "\n"; }
else { print $USAGE; }
}
}
|