1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at http://curl.haxx.se/docs/copyright.html.
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
21 # $Id: ftp.pm,v 1.1.1.1 2008-09-23 16:32:06 hoffman Exp $
22 ###########################################################################
24 #######################################################################
25 # Return the pid of the server as found in the given pid file
29 open(PFILE
, "<$PIDFILE");
35 #######################################################################
36 # Check the given test server if it is still alive.
44 $pid=serverpid
($pidfile);
45 if ($pid ne "" && kill(0, $pid)) {
49 return -$pid; # negative means dead process
55 #############################################################################
56 # Kill a specific slave
59 my ($id, $ext, $verbose)=@_;
61 for $base (('filt', 'data')) {
62 my $f = ".sock$base$id$ext.pid";
63 my $pid = checkserver
($f);
65 printf ("* kill pid for %s => %d\n", "ftp-$base$id$ext", $pid) if($verbose);
66 kill (9, $pid); # die!
74 #############################################################################
75 # Make sure no FTP leftovers are still running. Kill all slave processes.
76 # This uses pidfiles since it might be used by other processes.
80 for $ext (("", "ipv6")) {
82 ftpkillslave
($id, $ext, $verbose);
88 sub set_advisor_read_lock
{
91 if(open(FILEH
, ">$filename")) {
95 printf "Error creating lock file $filename error: $!";
99 sub clear_advisor_read_lock
{