Handle hostnames with upper-case letters
[webmin.git] / init / start_stop.cgi
1 #!/usr/local/bin/perl
2 # start_stop.cgi
3 # Start or stop a boot-time action
4
5 require './init-lib.pl';
6 &foreign_require("proc", "proc-lib.pl");
7 $access{'bootup'} || &error($text{'ss_ecannot'});
8 &ReadParse();
9
10 # Work out the correct command, and show header
11 $| = 1;
12 $theme_no_header = 1;
13 foreach $a ('start', 'restart', 'condrestart', 'reload', 'status', 'stop') {
14         if (defined($in{$a})) {
15                 $action = $a;
16                 }
17         }
18 $action ||= 'stop';
19 &ui_print_header(undef, $text{'ss_'.$action}, "");
20 $cmd = $in{'file'}." ".$action;
21
22 # In case the action was Webmin
23 $SIG{'TERM'} = sub { };
24
25 # Run the command
26 print &text('ss_exec', "<tt>$cmd</tt>"),"<p>\n";
27 print "<pre>";
28 &foreign_call("proc", "safe_process_exec_logged", $cmd, 0, 0, STDOUT, undef, 1);
29 print "</pre>\n";
30 &webmin_log($action, 'action', $in{'name'});
31
32 &ui_print_footer($in{'back'}, $text{'edit_return'});
33