Handle hostnames with upper-case letters
[webmin.git] / proc / kill_proc_list.cgi
1 #!/usr/local/bin/perl
2 # kill_proc_list.cgi
3 # Send a signal to a list of process
4
5 require './proc-lib.pl';
6 &ReadParse();
7 &switch_acl_uid();
8 foreach $s ('KILL', 'TERM', 'HUP', 'STOP', 'CONT') {
9         $in{'signal'} = $s if ($in{$s});
10         }
11
12 &ui_print_unbuffered_header(undef, $text{'kill_title'}, "");
13 @pidlist = split(/\s+/, $in{pidlist});
14 @pinfo = &list_processes(@pidlist);
15 for($i=0; $i<@pidlist; $i++) {
16         $in{"args$i"} = $pinfo[$i]->{'args'};
17         print "$text{'pid'} <tt>$pidlist[$i]</tt> ... \n";
18         if (&can_edit_process($pinfo[$i]->{'user'})) {
19                 if (&kill_logged($in{signal}, $pidlist[$i])) {
20                         print "SIG$in{signal} $text{'kill_sent'}<br>\n";
21                         }
22                 else {
23                         print "$!<br>\n";
24                         }
25                 }
26         else {
27                 print "$text{'kill_ecannot'}<br>\n";
28                 }
29         }
30 &webmin_log("kill", undef, undef, \%in);
31 print "<p>\n";
32 &ui_print_footer("index_search.cgi?$in{'args'}", $text{'search_return'});
33