2 # Start or stop a bunch of upstart services
4 require './init-lib.pl';
6 @sel = split(/\0/, $in{'d'});
7 @sel || &error($text{'mass_enone'});
9 $start = 1 if ($in{'start'} || $in{'addboot_start'});
10 $stop = 1 if ($in{'stop'} || $in{'delboot_stop'});
11 $restart = 1 if ($in{'restart'} || $in{'delboot_restart'});
12 $enable = 1 if ($in{'addboot'} || $in{'addboot_start'});
13 $disable = 1 if ($in{'delboot'} || $in{'delboot_stop'});
15 &ui_print_unbuffered_header(undef, $start || $enable ? $text{'mass_ustart'}
16 : $text{'mass_ustop'}, "");
18 if ($start || $stop || $restart) {
19 # Starting or stopping a bunch of services
20 $access{'bootup'} || &error($text{'ss_ecannot'});
23 print &text('mass_ustarting', "<tt>$s</tt>"),"<p>\n";
24 ($ok, $out) = &start_upstart_service($s);
27 print &text('mass_ustopping', "<tt>$s</tt>"),"<p>\n";
28 ($ok, $out) = &stop_upstart_service($s);
31 print &text('mass_urestarting', "<tt>$s</tt>"),"<p>\n";
32 ($ok, $out) = &restart_upstart_service($s);
34 print "<pre>$out</pre>";
36 print $text{'mass_failed'},"<p>\n";
39 print $text{'mass_ok'},"<p>\n";
42 &webmin_log($start ? 'massstart' : $stop ? 'massstop' : 'massrestart',
43 'upstart', join(" ", @sel));
46 if ($enable || $disable) {
47 # Enable or disable at boot
48 $access{'bootup'} == 1 || &error($text{'edit_ecannot'});
51 print &text('mass_uenable', "<tt>$b</tt>"),"<p>\n";
55 print &text('mass_udisable', "<tt>$b</tt>"),"<p>\n";
59 &webmin_log($enable ? 'massenable' : 'massdisable', 'upstart',
64 &ui_print_footer("edit_upstart.cgi?name=".&urlize($in{'return'}),
65 $text{'upstart_return'});
68 &ui_print_footer("", $text{'index_return'});