-
Notifications
You must be signed in to change notification settings - Fork 0
/
mass.cgi
executable file
·75 lines (66 loc) · 1.76 KB
/
mass.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/local/bin/perl
# Start, stop or delete multiple actions
use strict;
use warnings;
our (%text, %in);
require './virtualmin-init-lib.pl';
&ReadParse();
my @d = split(/\0/, $in{'d'});
@d || &error($text{'mass_enone'});
# Get the actions
my @dominits;
foreach my $di (@d) {
my ($did, $name) = split(/\//, $di);
my $d = &virtual_server::get_domain($did);
my ($init) = grep { $_->{'name'} eq $name } &list_domain_actions($d);
if ($d && $init) {
push(@dominits, [ $d, $init ]);
}
}
my $idx = "index.cgi?dom=$dominits[0]->[0]->{'id'}";
if ($in{'delete'}) {
# Delete them all
foreach my $di (@dominits) {
&delete_domain_action($di->[0], $di->[1]);
}
&redirect($idx);
}
elsif ($in{'startnow'}) {
# Start them in series
&ui_print_unbuffered_header(undef, $text{'start_titles'}, "");
foreach my $di (@dominits) {
print &text('start_starting',
"<tt>$di->[1]->{'name'}</tt>"),"\n";
print "<pre>";
&start_domain_action($di->[0], $di->[1]);
print "</pre>";
}
&ui_print_footer($idx, $text{'index_return'});
}
elsif ($in{'stopnow'}) {
# Stop them in series
&ui_print_unbuffered_header(undef, $text{'stop_titles'}, "");
foreach my $di (@dominits) {
print &text('stop_stopping',
"<tt>$di->[1]->{'name'}</tt>"),"\n";
print "<pre>";
&stop_domain_action($di->[0], $di->[1]);
print "</pre>";
}
&ui_print_footer($idx, $text{'index_return'});
}
elsif ($in{'restartnow'}) {
# Restart them in series
&ui_print_unbuffered_header(undef, $text{'restart_titles'}, "");
foreach my $di (@dominits) {
print &text('restart_restarting',
"<tt>$di->[1]->{'name'}</tt>"),"\n";
print "<pre>";
&restart_domain_action($di->[0], $di->[1]);
print "</pre>";
}
&ui_print_footer($idx, $text{'index_return'});
}
else {
&error("No button clicked!");
}