Mon Jan 10 17:03:18 PST 2005
- Previous message: [Slony1-commit] By cbbrowne: Use $SEQUENCE_ID rather than $SEQID, which will become an
- Next message: [Slony1-commit] By cbbrowne: Have a sequence parameter, $SEQUENCE_ID, to manage sequence
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message:
-----------
Add usage output
Potentially use environment to determine where cluster information is
Turn reused logic into a function
Modified Files:
--------------
slony1-engine/tools/altperl:
slon_kill.pl (r1.4 -> r1.5)
-------------- next part --------------
Index: slon_kill.pl
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slon_kill.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -Ltools/altperl/slon_kill.pl -Ltools/altperl/slon_kill.pl -u -w -r1.4 -r1.5
--- tools/altperl/slon_kill.pl
+++ tools/altperl/slon_kill.pl
@@ -1,47 +1,61 @@
-#!perl # -*- perl -*-
+#!/usr/bin/perl # -*- perl -*-
# $Id$
# 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
+
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
open(PSOUT, ps_args() . " | egrep '[s]lon_watchdog' | sort -n | awk '{print \$2}'|");
-$found="n";
-while ($pid = <PSOUT>) {
- chomp $pid;
- if (!($pid)) {
- print "No slon_watchdog is running for set $SETNAME!\n";
- } else {
- $found="y";
- kill 9, $pid;
- print "slon_watchdog for set $SETNAME killed - PID [$pid]\n";
- }
-}
+shut_off_processes();
close(PSOUT);
if ($found eq 'n') {
print "No watchdogs found\n";
}
print "\n2. Kill slon processes\n";
+
#kill the slon daemon
$found="n";
open(PSOUT, ps_args() . " | egrep \"[s]lon .*$SETNAME\" | sort -n | awk '{print \$2}'|");
+shut_off_processes();
+close(PSOUT);
+if ($found eq 'n') {
+ print "No slon processes found\n";
+}
+
+sub shut_off_processes {
+ $found="n";
while ($pid = <PSOUT>) {
chomp $pid;
if (!($pid)) {
- print "No Slon is running for set $SETNAME!\n";
+ print "No slon_watchdog is running for set $SETNAME!\n";
} else {
- kill 9, $pid;
- print "Slon for set $SETNAME killed - PID [$pid]\n";
$found="y";
+ kill 9, $pid;
+ print "slon_watchdog for set $SETNAME killed - PID [$pid]\n";
}
}
-close(PSOUT);
-if ($found eq 'n') {
- print "No slon processes found\n";
}
- Previous message: [Slony1-commit] By cbbrowne: Use $SEQUENCE_ID rather than $SEQID, which will become an
- Next message: [Slony1-commit] By cbbrowne: Have a sequence parameter, $SEQUENCE_ID, to manage sequence
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list