IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27251 for trunk


Ignore:
Timestamp:
Mar 11, 2010, 11:26:26 AM (16 years ago)
Author:
Paul Price
Message:

Allow use for a host other than the local.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neb_size.pl

    r27250 r27251  
    99
    1010
    11 my $hostname = `hostname`;      # Name of host
    12 chomp $hostname;
    13 
    1411
    1512my ($db_host, $db_name, $db_user, $db_pw); # Database details
    1613my ($step);                                # Step in ins_id
     14my $hostname;
    1715
    1816GetOptions(
     
    2119    'dbuser=s' => \$db_user, # Database user
    2220    'dbpass=s' => \$db_pw, # Database p/w
     21    'hostname=s' => \$hostname, # Host name
    2322    'step=s' => \$step,    # Step in ins_id
    2423           ) or die "Unable to parse arguments.\n";
     
    3029    and defined $db_pw
    3130    and defined $step;
     31
     32unless (defined $hostname) {
     33    $hostname = `hostname`;
     34    chomp $hostname;
     35}
     36
    3237
    3338# Database connection
     
    4550}
    4651
    47 my $sum = 0;                    # Sum of sizes
     52my $size = 0;                   # Sum of sizes
     53my $num = 0;                    # Number of files
    4854for (my $i = 0; $i < $max_ins; $i += $step) {
    4955    my $min = $i;               # Minimum instance for query
     
    5763        my $uri = $$result[0];
    5864        $uri =~ s|^file:||;
    59         my $size = -s $uri;
    60         $sum += $size;
     65        $size += -s $uri;
     66        $num++;
    6167    }
    6268}
    6369
    64 print "$hostname: $sum\n";
     70print "$hostname: $size ($num files)\n";
Note: See TracChangeset for help on using the changeset viewer.