|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /proc/self/root/usr/libexec/webmin/init/ |
Upload File : |
#!/usr/bin/perl
# start_stop.cgi
# Start or stop a boot-time action
require './init-lib.pl';
&foreign_require("proc", "proc-lib.pl");
$access{'bootup'} || &error($text{'ss_ecannot'});
&ReadParse();
# Work out the correct command, and show header
$| = 1;
$theme_no_header = 1;
if (defined($in{'start'})) {
&ui_print_header(undef, $text{'ss_start'}, "");
$cmd = "$in{'file'} start";
}
elsif (defined($in{'restart'})) {
&ui_print_header(undef, $text{'ss_restart'}, "");
$cmd = "$in{'file'} restart";
}
elsif (defined($in{'condrestart'})) {
&ui_print_header(undef, $text{'ss_restart'}, "");
$cmd = "$in{'file'} condrestart";
}
elsif (defined($in{'reload'})) {
&ui_print_header(undef, $text{'ss_reload'}, "");
$cmd = "$in{'file'} reload";
}
elsif (defined($in{'status'})) {
&ui_print_header(undef, $text{'ss_status'}, "");
$cmd = "$in{'file'} status";
}
else {
&ui_print_header(undef, $text{'ss_stop'}, "");
$cmd = "$in{'file'} stop";
}
# In case the action was Webmin
$SIG{'TERM'} = 'IGNORE';
# Run the command
print &text('ss_exec', "<tt>$cmd</tt>"),"<p>\n";
print "<pre>";
&foreign_call("proc", "safe_process_exec_logged", $cmd, 0, 0, STDOUT, undef, 1);
print "</pre>\n";
&webmin_log($in{'start'} ? 'start' : 'stop', 'action', $in{'name'});
&ui_print_footer($in{'back'}, $text{'edit_return'});