/usr/bin/slon_start 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 65 66 67 68 69 70 71 72 73 74 75 76 77 | #!/usr/bin/perl
#
# Author: Christopher Browne
# Copyright 2004-2009 Afilias Canada
use Getopt::Long;
# Defaults
$START_WATCHDOG = 1;
$SLEEP_TIME = 30;
$CONFIG_FILE = '/etc/slony1/slon_tools.conf';
$SHOW_USAGE = 0;
$WATCHDOG_VERSION = 1;
# Read command-line options
GetOptions("config=s" => \$CONFIG_FILE,
"watchdog!" => \$START_WATCHDOG,
"sleep=i" => \$SLEEP_TIME,
"help" => \$SHOW_USAGE);
my $USAGE =
"Usage: slon_start [--config file] [--watchdog|--nowatchdog]
[--sleep seconds] node#
--config file Location of the slon_tools.conf file
--watchdog Start a watchdog process after starting the slon
daemon (default)
--nowatchdog Do not start a watchdog process
--sleep seconds Number of seconds for the watchdog process to sleep
between checks (default 30)
";
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;
}
$pid = get_pid($node);
if ($pid) {
die "Slon is already running for the '$CLUSTER_NAME' cluster.\n";
}
my $dsn = $DSN[$nodenum];
my $dbname = $DBNAME[$nodenum];
start_slon($nodenum);
$pid = get_pid($node);
unless ($pid) {
print "Slon failed to start for cluster $CLUSTER_NAME, node $node\n";
} else {
print "Slon successfully started for cluster $CLUSTER_NAME, node $node\n";
print "PID [$pid]\n";
if ($START_WATCHDOG) {
print "Start the watchdog process as well...\n";
if( $WATCHDOG_VERSION eq 2 ) {
system "/usr/bin/slon_watchdog2 --config=$CONFIG_FILE $node $SLEEP_TIME &";
} else {
system "/usr/bin/slon_watchdog --config=$CONFIG_FILE $node $SLEEP_TIME &";
}
}
}
|