Holger Parplies wrote: > Hi, > > Les Stott wrote on 14.11.2007 at 00:22:35 [Re: [BackupPC-users] Is there a > command line reporting tool for backuppc?]: > >> I was wondering if you could help out with two additional changes........ >> >> I want to run this script as a DumpPostUserCmd such that i can email a >> small report with some detail about what the backup did. >> >> The output of the script is great, but it runs for all hosts, I'd like >> it to only run for the host that is being backed up. How can i make it >> use say $1 as an argument for the host (i.e. using $client from the >> DumpPostUserCmd)?? >> > > sorry for keeping you waiting so long for such a simple matter. I was > planning to do it "properly", but my time is currently in short supply, so > here's a quick hack for the time being: > > change line 40: > > -foreach my $host (@hosts) { > +foreach my $host (@ARGV ? @ARGV : @hosts) { > > Now any parameters to the script will be interpreted as host names to report > on. Without parameters you get a full list. > Thanks Holger, that works great!
As much as that is a quick hack i like it because you can still run the script for all hosts, say weekly to an admin, yet at each backup just run as DumpPostUserCmd looking for each single host via parameters. > >> Second..... >> >> if it shows xfer errors how easy would it be to append the xferlog to >> the email? >> > > Well, you *could* add something like > > my $topdir = $bpc -> TopDir (); > open XFERLOG, "/path/to/BackupPC_zcat > $topdir/pc/$host/XferLOG.$backup->{num}.z |" > or die "Can't BackupPC_zcat XferLOG: $!\n"; > while (<XFERLOG>) { > print > if /DENIED/ and not /System Volume Information|RECYCLER|Watson/; > } > close XFERLOG; # or error handling, really > > after line 67 (the "*WARNING* Backup with ERRORs!" line), but you probably > want a proper MIME attachment (even more so if you call it for more than one > host at a time!), meaning you want to integrate sending the e-Mail into the > script, requiring option handling and so on. I'll get back to it, but not in > the next few weeks. > > No dramas, i know what its like to have a list of jobs that number the hundreds! okay, hundreds was an exaggeration, but it feels like that sometimes ;) I'm happy to wait for attaching xferlogs, although i did test the above code and found two things...... 1. If compression is turned off in config.pl the log files don't compress and remain as "XferLOG.1003", thus BackupPC_zcat fails. 2. the above code does work when the log file is compressed, however it gives you the entire file, which can be large. I reckon just the errors attached would be perfect, exactly like what the CGI interface does when you use the "errors" link on viewing the XferLog of a backup. Again, no rush on this. The first "quick hack" is what i really wanted for implementation straight away. TIA Regards, Les ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List: https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki: http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/