mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Start/stop buttons per service, ability to comment out multi-line start blocks
This commit is contained in:
@@ -73,8 +73,8 @@ if ($in{'new'}) {
|
||||
}
|
||||
else {
|
||||
print &ui_form_end([ [ undef, $text{'save'} ],
|
||||
[ 'start', $text{'index_start'} ],
|
||||
[ 'stop', $text{'index_stop'} ],
|
||||
[ 'start', $text{'edit_startnow'} ],
|
||||
[ 'stop', $text{'edit_stopnow'} ],
|
||||
[ 'delete', $text{'delete'} ] ]);
|
||||
}
|
||||
|
||||
|
||||
@@ -602,9 +602,19 @@ if ($init_mode eq "upstart" && (!-r "$config{'init_dir'}/$_[0]" ||
|
||||
# Config file exists, make sure it is enabled
|
||||
&system_logged("insserv ".quotemeta($_[0])." >/dev/null 2>&1");
|
||||
my $lref = &read_file_lines($cfile);
|
||||
my $foundstart;
|
||||
foreach my $l (@$lref) {
|
||||
if ($l =~ /^#+\s*start/) {
|
||||
if ($l =~ /^#+start/) {
|
||||
# Start of start block
|
||||
$l =~ s/^#+//;
|
||||
$foundstart = 1;
|
||||
}
|
||||
elsif ($l =~ /^#+\s+\S/ && $foundstart) {
|
||||
# Continuation line for start
|
||||
$l =~ s/^#+//;
|
||||
}
|
||||
elsif ($l =~ /^\S/ && $foundstart) {
|
||||
# Some other directive after start
|
||||
last;
|
||||
}
|
||||
}
|
||||
@@ -917,9 +927,19 @@ if ($init_mode eq "upstart") {
|
||||
my $cfile = "/etc/init/$_[0].conf";
|
||||
if (-r $cfile) {
|
||||
my $lref = &read_file_lines($cfile);
|
||||
my $foundstart;
|
||||
foreach my $l (@$lref) {
|
||||
if ($l =~ /^\s*start/) {
|
||||
if ($l =~ /^start\s/) {
|
||||
# Start of start block
|
||||
$l = "#".$l;
|
||||
$foundstart = 1;
|
||||
}
|
||||
elsif ($l =~ /^\s+\S/ && $foundstart) {
|
||||
# Continuation line for start
|
||||
$l = "#".$l;
|
||||
}
|
||||
elsif ($l =~ /^\S/ && $foundstart) {
|
||||
# Some other directive after start
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,5 +206,6 @@ upstart_eclash=A service with the same name already exists
|
||||
upstart_edesc=Missing service description
|
||||
upstart_eserver=No server command entered
|
||||
upstart_eserver2=Server command does not exist
|
||||
upstart_return=upstart service
|
||||
|
||||
__norefs=1
|
||||
|
||||
@@ -53,4 +53,10 @@ if ($enable || $disable) {
|
||||
join(" ", @sel));
|
||||
}
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
if ($in{'return'}) {
|
||||
&ui_print_footer("edit_upstart.cgi?name=".&urlize($in{'return'}),
|
||||
$text{'upstart_return'});
|
||||
}
|
||||
else {
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
}
|
||||
|
||||
@@ -17,8 +17,9 @@ if (!$in{'new'}) {
|
||||
|
||||
if ($in{'start'} || $in{'stop'}) {
|
||||
# Just redirect to the start page
|
||||
&redirect("mass_upstarts.cgi?d=".&urlize($in{'name'}).
|
||||
($in{'start'} ? "start=1" : "stop=1"));
|
||||
&redirect("mass_upstarts.cgi?d=".&urlize($in{'name'})."&".
|
||||
($in{'start'} ? "start=1" : "stop=1").
|
||||
"&return=".&urlize($in{'name'}));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user