3 # Run a command on multiple servers at once
6 require './cluster-copy-lib.pl';
8 $copy = &get_copy($ARGV[0]);
9 $copy || die "Copy ID $ARGV[0] does not exist!";
10 $ENV{'SERVER_ROOT'} = $root_directory; # hack to make 'this server' work
11 $status = "succeeded";
12 &run_cluster_job($copy, \&callback);
14 if ($copy->{'email'}) {
15 # Email off status message
16 &foreign_require("mailboxes", "mailboxes-lib.pl");
18 # Construct and send the email
19 local $from = $config{'from'} || &mailboxes::get_from_address();
20 local @files = split(/\t+/, $copy->{'files'});
21 local $subject = &text('email_subject_'.$status, join(", ", @files));
22 &mailboxes::send_text_mail($from, $copy->{'email'}, undef, $subject,
26 # callback(error, &server, message, dirs, command-output)
29 local $d = $_[1]->{'desc'} || $_[1]->{'host'};
32 $results .= &text('exec_on', $d, $_[2])."\n\n";
37 # Show pre command output
38 $results .= &text('exec_before', $d)."\n";
43 # Show created directories
44 $results .= &text('exec_made', $d)."\n";
45 foreach $f (@{$_[4]}) {
52 $results .= &text('exec_nothing', $d)."\n";
56 $results .= &text('exec_success', $d)."\n";
57 foreach $f (@{$_[2]}) {
64 $results .= &text('exec_not', $d)."\n";
65 foreach $f (@{$_[3]}) {
66 $results .= " $f->[0] : $f->[1]\n";
71 # Show post command output
72 $results .= &text('exec_cmd', $d)."\n";