patch #8105
[mldonkey.git] / distrib / kill_mldonkey
blob61c62f41d7420064534ba2a52b19d7e3a0a9a679
1 #!/usr/bin/perl
2 use LWP::UserAgent;
4 # Put Username and password into to /etc/sysconfig/donkey
5 # like this:
7 # HTTPUSER=you
8 # HTTPPASS=yourpassword
10 my $cfg = "/etc/sysconfig/donkey";
11 open(I,"<$cfg") || die "Can't read $cfg: $!\n";
12 chomp (my @lines = (<I>));
13 close I;
14 foreach (@lines) {
15 next if (/^#/);
16 if (/([^=\s]+)=([^=\s]+)/) {
17 $vars{$1}="$2";
20 my $ua = LWP::UserAgent->new;
21 my $req = HTTP::Request->new(GET => 'http://localhost:4080/submit?q=kill');
22 if (($vars{'HTTPUSER'}) && ($vars{'HTTPPASS'})) {
23 $req->authorization_basic($vars{'HTTPUSER'}, $vars{'HTTPPASS'});
25 $ua->request($req);