# $Header$
# Utility to kill all clients attached to an ObjectStore server
use warnings;
use strict;
die "wrong number of arguments: @ARGV" if (@ARGV < 1);
my $serverHost = shift @ARGV || die "missing server host as parameter: $!";
my @execResult;
my @clients;
# Any clients to kill?
print("Connected clients:\n");
@execResult = `"ossvrstat -clients $serverHost"`;
for (@execResult) {
# Client #123 (sg.classix.local/2296/SG/SG)
if ($_ =~ /Client.*\((.+?)\//) {
print(" $1\n");
push(@clients, $1);
}
}
# Kill clients
print("\nKilling clients...\n");
for (@clients) {
print(" $_\n");
`"ossvrclntkill $serverHost -h $_"`;
}
# Still any clients?
print("\nStill connected clients:\n");
@clients = ();
@execResult = `"ossvrstat -clients $serverHost"`;
for (@execResult) {
# Client #123 (sg.classix.local/2296/SG/SG)
if ($_ =~ /Client.*\((.+?)\//) {
print(" $1\n");
push(@clients, $1);
}
}
if (scalar(@clients)) {
die "There are still connected clients\n";
}