Changeset 448


Ignore:
Timestamp:
Jan 21, 2007, 11:08:01 AM (13 years ago)
Author:
Nick Burch
Message:

Support meta upload, and show progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/scripts/tile-processing/upload.pl

    r408 r448  
    22use strict;
    33
     4# Path to the scale directory on each server
     5my %servers;
     6$servers{dev} = "/usr/local/OSGB/";
     7$servers{encore} = "/usr/local/maps/OSGB/";
     8$servers{urchin} = "/srv/www/tile.npemap.org.uk/html/";
     9$servers{bitclean} = "/home/bitclean/public_html/";
     10
     11# Allow restricting to just one server
     12if($ARGV[0] && $servers{$ARGV[0]}) {
     13        my $srv = shift @ARGV;
     14        print "Restricting to just server $srv\n";
     15        my %srvs;
     16        $srvs{$srv} = $servers{$srv};
     17        %servers = %srvs;
     18}
     19
     20# Process the rest of the arguments
    421my $scale = shift @ARGV;
    522my @args = @ARGV;
     
    1229        exit 1;
    1330}
    14 unless($scale == 1 || $scale == 3 || $scale == 6) {
    15         die("Scale must be the 1st argument, and one of 1, 3 or 6\n");
     31unless($scale == 1 || $scale == 3 || $scale == 6 || $scale eq 'm') {
     32        die("Scale must be the 1st argument, and one of 1, 3, 6 or m\n");
    1633}
    1734
     
    1936print "About to upload ".join(" ",@args)." for scale $scale\n\n";
    2037
    21 # Path to the scale directory on each server
    22 my %servers;
    23 $servers{dev} = "/usr/local/OSGB/";
    24 $servers{encore} = "/usr/local/maps/OSGB/";
    25 $servers{urchin} = "/srv/www/tile.npemap.org.uk/html/";
     38my $dir = "scaled$scale/";
     39if($scale eq 'm') {
     40        $dir = "meta1/";
     41}
    2642
    2743# Upload each in turn
    2844foreach my $server (reverse sort keys %servers) {
    29         my $path = $servers{$server} . "scaled$scale/";
     45        my $path = $servers{$server} . $dir;
    3046
    3147        my $cmd = "rsync -avc ".join(" ",@args)." $server:$path";
    3248        print $cmd."\n";
    33         print `$cmd`;
     49        print `$cmd 1>&2`;
    3450}
    3551print "\n\n";
    3652
    3753# Fix permissions on urchin
    38 my $cmd = "ssh urchin 'cd $servers{urchin}scaled$scale/ && chown -R .npemap ".join(" ",@args)."'";
     54my $cmd = "ssh urchin 'cd $servers{urchin}$dir && chown -R .npemap ".join(" ",@args)."'";
    3955print $cmd."\n";
    4056`$cmd`;
Note: See TracChangeset for help on using the changeset viewer.