mirror of
https://github.com/moparisthebest/curl
synced 2024-10-31 15:45:12 -04:00
added function for individual ftp slave kills
This commit is contained in:
parent
640d67c119
commit
ac5635f77d
28
tests/ftp.pm
28
tests/ftp.pm
@ -29,6 +29,24 @@ sub checkserver {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Kill a specific slave
|
||||||
|
#
|
||||||
|
sub ftpkillslave {
|
||||||
|
my ($id, $ext, $verbose)=@_;
|
||||||
|
my $base;
|
||||||
|
for $base (('filt', 'data')) {
|
||||||
|
my $f = ".sock$base$id$ext.pid";
|
||||||
|
my $pid = checkserver($f);
|
||||||
|
if($pid > 0) {
|
||||||
|
printf ("* kill pid for %s => %d\n", "ftp-$base$id$ext", $pid) if($verbose);
|
||||||
|
kill (9, $pid); # die!
|
||||||
|
}
|
||||||
|
unlink($f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Make sure no FTP leftovers are still running. Kill all slave processes.
|
# Make sure no FTP leftovers are still running. Kill all slave processes.
|
||||||
# This uses pidfiles since it might be used by other processes.
|
# This uses pidfiles since it might be used by other processes.
|
||||||
@ -37,15 +55,7 @@ sub ftpkillslaves {
|
|||||||
my ($versbose) = @_;
|
my ($versbose) = @_;
|
||||||
for $ext (("", "ipv6")) {
|
for $ext (("", "ipv6")) {
|
||||||
for $id (("", "2")) {
|
for $id (("", "2")) {
|
||||||
for $base (('filt', 'data')) {
|
ftpkillslave ($id, $ext, $verbose);
|
||||||
my $f = ".sock$base$id$ext.pid";
|
|
||||||
my $pid = checkserver($f);
|
|
||||||
if($pid > 0) {
|
|
||||||
printf ("* kill pid for %-5s => %-5d\n", "ftp-$base$id$ext", $pid) if($verbose);
|
|
||||||
kill (9, $pid); # die!
|
|
||||||
}
|
|
||||||
unlink($f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user