This file is indexed.

/usr/bin/slon_kill 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
111
112
113
114
115
#!/usr/bin/perl
# 
# Kill all slon instances for the current cluster
# Author: Christopher Browne
# Copyright 2004-2009 Afilias Canada

use Getopt::Long;

# Defaults
$CONFIG_FILE = '/etc/slony1/slon_tools.conf';
$SHOW_USAGE  = 0;
$WATCHDOG_ONLY = 0;
$ONLY_NODE = 0;

# Read command-line options
GetOptions("config=s"   => \$CONFIG_FILE,
	   "help"       => \$SHOW_USAGE,
	   "w|watchdog" => \$WATCHDOG_ONLY,
	   "only-node=i" => \$ONLY_NODE);

my $USAGE =
"Usage: slon_kill [--config file] [-w|--watchdog] 

    --config file  Location of the slon_tools.conf file

    -w
    --watchdog     Only kill the watchdog process(es)

    Kills all running slon and slon_watchdog on this machine for every
    node in the cluster.

    --only-node=i Only kill slon processes for the indicated node
";

if ($SHOW_USAGE) {
  print $USAGE;
  exit 0;
}

require '/usr/share/slony1/slon-tools.pm';
require $CONFIG_FILE;

print "slon_kill.pl...   Killing all slon and slon_watchdog instances for the cluster $CLUSTER_NAME\n";
print "1.  Kill slon watchdogs\n";

$found="n";

# kill the watchdogs
if($ONLY_NODE) {
  kill_watchdog($ONLY_NODE);
} else {
  for my $nodenum (@NODES) {
    kill_watchdog($nodenum);
  }
}
if ($found eq 'n') {
    print "No watchdogs found\n";
}

unless ($WATCHDOG_ONLY) {
    print "\n2. Kill slon processes\n";

    # kill the slon daemons
    $found="n";

    if($ONLY_NODE) {
      kill_slon_node( $ONLY_NODE );
    } else {
      for my $nodenum (@NODES) {
        kill_slon_node( $nodenum );
      }
    }

    if ($found eq 'n') {
      print "No slon processes found\n";
    }
}

sub kill_watchdog($) {
  my ($nodenum) = @_;

  my $config_regexp = quotemeta( $CONFIG_FILE );

  my $command =  ps_args() . "| egrep \"[s]lon_watchdog[2]? .*=$config_regexp node$nodenum \" | awk '{print \$2}' | sort -n";

  #print "Command:\n$command\n";
  open(PSOUT, "$command|");

  while ($pid = <PSOUT>) {
      chomp $pid;
      if (!($pid)) {
          print "No slon_watchdog is running for the cluster $CLUSTER_NAME, node $nodenum!\n";
      } else {
          $found="y";
          kill 9, $pid;
          print "slon_watchdog for cluster $CLUSTER_NAME node $nodenum killed - PID [$pid]\n";
      }
  }
  close(PSOUT);
}

sub kill_slon_node($) {
  my ($nodenum) = @_;

  my $pid = get_pid($nodenum);

  #print "Command:\n$command\n";
  if (!($pid)) {
    print "No slon is running for the cluster $CLUSTER_NAME, node $nodenum!\n";
  } else {
    $found="y";
    kill 15, $pid;
    print "slon for cluster $CLUSTER_NAME node $nodenum killed - PID [$pid]\n";
  }
}