Handle hostnames with upper-case letters
[webmin.git] / squid / stop.cgi
1 #!/usr/local/bin/perl
2 # stop.cgi
3 # Stop the running squid process
4
5 require './squid-lib.pl';
6 $access{'start'} || &error($text{'stop_ecannot'});
7 &ReadParse();
8 $whatfailed = $text{'stop_ftsq'};
9 if ($config{'squid_stop'}) {
10         # Use a stop script
11         $out = &backquote_logged("$config{'squid_stop'} 2>&1");
12         if ($out && $out =~ /\d+\/\d+\/\d+/) {
13                 &error("<pre>$out</pre>");
14                 }
15         }
16 else {
17         # Run the squid executable directly
18         $out = &backquote_logged("$config{'squid_path'} -f $config{'squid_conf'} -k shutdown 2>&1");
19         if ($out) { &error("<pre>$out</pre>"); }
20         }
21 for($i=0; $i<40; $i++) {
22         if (!kill(0, $in{'pid'})) { last; }
23         sleep(1);
24         }
25 &webmin_log("stop");
26 &redirect($in{'redir'});
27