added humanly readable unit (b k M G)
[BackupPC.git] / bin / BackupPC_archiveStart
index ceee9a4..c527fa4 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/perl
+#!/usr/bin/perl
 #============================================================= -*-perl-*-
 #
 # BackupPC_archiveStart: start an archive request from the
 #============================================================= -*-perl-*-
 #
 # BackupPC_archiveStart: start an archive request from the
@@ -17,7 +17,7 @@
 #   Craig Barratt  <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
 #   Craig Barratt  <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2007  Craig Barratt
+#   Copyright (C) 2007-2009  Craig Barratt
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@
 #
 #========================================================================
 #
 #
 #========================================================================
 #
-# Version 3.2.0beta0, released 17 Jan 2009.
+# Version 3.2.0, released 31 Jul 2010.
 #
 # See http://backuppc.sourceforge.net.
 #
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -54,7 +54,7 @@ my %opts;
 # no options currently
 if ( !getopts("", \%opts) || @ARGV < 3 ) {
     print STDERR <<EOF;
 # no options currently
 if ( !getopts("", \%opts) || @ARGV < 3 ) {
     print STDERR <<EOF;
-usage: $0 archiveHost userName hosts...
+usage: $0 archiveHost userName hosts[:num]...
 EOF
     exit(1);
 }
 EOF
     exit(1);
 }
@@ -72,7 +72,7 @@ $bpc->ConfigRead($ArchiveHost);
 
 my(@HostList, @BackupList);
 for ( my $i = 2 ; $i < @ARGV ; $i++ ) {
 
 my(@HostList, @BackupList);
 for ( my $i = 2 ; $i < @ARGV ; $i++ ) {
-    my $host = $ARGV[$i];
+    my ($host,$num) = split(/:/,$ARGV[$i],2);
     if ( !defined($Hosts->{$host}) ) {
         print(STDERR "$0: host $host doesn't exist... quitting\n");
         exit(1);
     if ( !defined($Hosts->{$host}) ) {
         print(STDERR "$0: host $host doesn't exist... quitting\n");
         exit(1);
@@ -83,7 +83,8 @@ for ( my $i = 2 ; $i < @ARGV ; $i++ ) {
         exit(1);
     }
     push(@HostList, $host);
         exit(1);
     }
     push(@HostList, $host);
-    push(@BackupList, $backups[$#backups]{num});
+    $num ||= $backups[$#backups]{num};
+    push(@BackupList, $num);
 }
 
 my $ReqFileName;
 }
 
 my $ReqFileName;