Steve Simms steve
Wed Jan 5 18:44:10 PST 2005
The same changes that I made to slon_start.pl, plus little whitespace
consistency changes.

The code that kills the slon and slon_watchdog processes looks like a prime
candidate for a function, since it's almost identical.  A patch for another
day, perhaps.

-- 
Steve Simms <steve at deefs.net>
http://www.deefs.net
-------------- next part --------------
--- ../altperl.orig/slon_kill.pl	2004-09-30 13:37:28.000000000 -0400
+++ slon_kill.pl	2005-01-04 19:50:16.000000000 -0500
@@ -1,16 +1,38 @@
-#!perl # -*- perl -*-
+#!/usr/bin/perl
 # $Id: slon_kill.pl,v 1.4.2.1 2004/09/30 17:37:28 cbbrowne Exp $
 # Kill all slon instances for the current setname
 # Author: Christopher Browne
 # Copyright 2004 Afilias Canada
 
+use Getopt::Long;
+
+$SLON_ENV_FILE = 'slon.env'; # Where to find the slon.env file
+$SHOW_USAGE    = 0;          # Show usage, then quit
+
+# Read command-line options
+GetOptions("config=s"  => \$SLON_ENV_FILE,
+	   "help"      => \$SHOW_USAGE);
+
 require 'slon-tools.pm';
-require 'slon.env';
+require $SLON_ENV_FILE;
+
+my $USAGE =
+"Usage: slon_kill.pl [--config file]
+
+   Kills all running slon and slon_watchdog instances for the set
+   specified in the config file.
+
+";
+
+if ($SHOW_USAGE) {
+  print $USAGE;
+  exit 0;
+}
 
 print "slon_kill.pl...   Killing all slon and slon_watchdog instances for setname $SETNAME\n";
 print "1.  Kill slon watchdogs\n";
-#kill the watchdog
 
+# kill the watchdog
 open(PSOUT, ps_args() . " | egrep '[s]lon_watchdog' | sort -n | awk '{print \$2}'|");
 $found="n";
 while ($pid = <PSOUT>) {
@@ -28,7 +50,8 @@
   print "No watchdogs found\n";
 }
 print "\n2. Kill slon processes\n";
-#kill the slon daemon
+
+# kill the slon daemon
 $found="n";
 open(PSOUT, ps_args() . " | egrep \"[s]lon .*$SETNAME\" | sort -n | awk '{print \$2}'|");
 while ($pid = <PSOUT>) {


More information about the Slony1-general mailing list