| Server IP : 172.67.134.114 / Your IP : 162.159.115.42 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/libexec/webmin/cluster-cron/ |
Upload File : |
#!/usr/bin/perl
# cron.pl
# Run a command on multiple servers at once
$no_acl_check++;
require './cluster-cron-lib.pl';
@jobs = &list_cluster_jobs();
($job) = grep { $_->{'cluster_id'} eq $ARGV[0] } @jobs;
$job || die "Job ID $ARGV[0] does not exist!";
$ENV{'SERVER_ROOT'} = $root_directory; # hack to make 'this server' work
&run_cluster_job($job, \&callback);
# callback(error, &server, message)
sub callback
{
local $d = $_[1]->{'desc'} || $_[1]->{'host'};
if (!$_[0]) {
# Failed - show error
print "Failed to run on $d : $_[2]\n\n";
}
else {
# Show output if any
if ($_[2]) {
print "Output from $d ..\n";
print $_[2];
print "\n";
}
}
}