}
}
+sub runPing()
+{
+ # This command generates ping output by pinging the host specified in the
+ # ping command still within @ARGV. However, if the host listed therein is
+ # a VE, the HN must be pinged instead.
+
+ # Get the host
+ my $host = shift(@ARGV);
+ my $cmd = join(' ', @ARGV);
+
+ # Find $host in the list of VEs
+ loadVeList();
+ my $hostname = gethostbyaddr(gethostbyname($host), AF_INET);
+ mydie "Host $host not found" if (!defined($hostname));
+ my $ve = getVeEntry('hostname', $hostname);
+ if (defined($ve)) {
+ $hostname = $ve->{'HN'};
+ mydie "HN is undefined for host $host" if (!defined($hostname));
+ $cmd =~ s/$host/$hostname/g;
+ print $dbgf ": ping request for $host remapped to HN $hostname\n";
+ }
+
+ cmdExecOrEval($cmd);
+}
+
sub runClient($)
{
my ($restore) = @_;
#print "Restore mode\n";
}
+my $ping = 0;
+if ($ARGV[0] eq "ping") {
+ shift(@ARGV);
+ $ping = 1;
+ #print "Ping mode\n";
+}
+
+print $dbgf ": server=$server, refresh=$refresh, restore=$restore ping=$ping";
+print $dbgf " on ".`date`;
if ($server) {
runServer($restore);
} elsif ($refresh) {
refreshConfig();
+} elsif ($ping) {
+ runPing();
} else {
runClient($restore);
}