1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

added function for individual ftp slave kills

This commit is contained in:
Daniel Stenberg 2005-05-25 12:26:38 +00:00
parent 640d67c119
commit ac5635f77d

View File

@ -29,6 +29,24 @@ sub checkserver {
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.
# This uses pidfiles since it might be used by other processes.
@ -37,15 +55,7 @@ sub ftpkillslaves {
my ($versbose) = @_;
for $ext (("", "ipv6")) {
for $id (("", "2")) {
for $base (('filt', 'data')) {
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);
}
ftpkillslave ($id, $ext, $verbose);
}
}
}