/usr/bin/slon_status is in slony1-2-bin 2.1.4-1ubuntu1.
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 | #!/usr/bin/perl
# Author: Devrim GÜNDÜZ <devrim@gunduz.org>
# Copyright 2009 Slony-I Global Development Group
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: slon_status [--config file] node#
--config file Location of the slon_tools.conf file
";
if ($SHOW_USAGE or scalar(@ARGV) != 1) {
die $USAGE;
}
require '/usr/share/slony1/slon-tools.pm';
require $CONFIG_FILE;
$node = $ARGV[0];
# Node can be passed either as "node1" or just "1"
if ($node =~ /^(?:node)?(\d+)$/) {
$node = "node$1";
$nodenum = $1;
} else {
die $USAGE;
}
$node_name = get_node_name($node);
if (!$node_name) {
die "There is no such node.\n";
}
$pid = get_pid($node);
if ($pid) {
die "Slon is running for the '$CLUSTER_NAME' cluster on $node.\n";
} else {
die "slon is not running for $node_name cluster.\n";
}
|