Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # NOTE: We don't use Anvil::Tools to keep overhead low and to keep this agent independent as possible.
- use strict;
- use warnings;
- # Turn off buffering so that the pinwheel will display while waiting for the SSH call(s) to complete.
- $| = 1;
- # Log file
- our $log_file = "/var/log/anvil.log";
- open (my $log_fh, ">>", $log_file) or die "Failed to open: [".$log_file."] for writing. The error was: ".$!."\n";
- $log_fh->autoflush(1);
- my $output = "";
- my $call_string = "/usr/bin/virsh list --all";
- print $log_fh "Calling: [".$call_string."]\n";
- open (my $file_handle, "-|", $call_string) or die "Print: Failed to call: [".$call_string."]\n";
- while(<$file_handle>)
- {
- chomp;
- my $line = $_;
- print $log_fh "line: [".$line."]\n";
- }
- close $file_handle;
- exit(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement