/[cvs]/joko/ToolBox/Windows/RsyncHere/RsyncHere-Job.pl
ViewVC logotype

Contents of /joko/ToolBox/Windows/RsyncHere/RsyncHere-Job.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Mon Oct 21 12:36:15 2002 UTC (21 years, 8 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
FILE REMOVED
- removed, is now "rsync-here.pl"

1 #!/usr/bin/perl
2
3 # ---------------------------------------------------------
4 # "Rsync Here" v0.01
5 # ---------------------------------------------------------
6
7 use strict;
8 use warnings;
9
10 # get / validate arguments
11 my $sourcePath_arg = shift;
12 if (!$sourcePath_arg) {
13 print "no source path given, exit.", "\n";
14 exit;
15 }
16
17 # config
18 my $bash = "bash";
19 my $rsync = "rsync";
20 my $remote_ssh_prefix = 'joko@martha';
21 my $remote_target_base = '~/backup';
22
23 # main - convert source path
24 my $sourcePath_win32 = $sourcePath_arg;
25 my $sourcePath = $sourcePath_win32;
26 $sourcePath =~ s/^(\w)://i;
27 my $sourcePath_volume = $1;
28 $sourcePath =~ s/\\/\//g;
29 #$sourcePath = "/cygdrive/$sourcePath_volume$sourcePath";
30
31 # strip leading and trailing slash, if any
32 $sourcePath =~ s/^\///;
33 $sourcePath =~ s/\/$//;
34
35 # make parts from path
36 #my @path = split(/\//, $sourcePath);
37 #my $sourcePath_rel = pop @path;
38 #my $sourcePath_base = join("/", @path);
39
40 #$sourcePath .= "/" if ($sourcePath !~ /\/$/);
41
42 # main - guess/build destination path
43 my $hostname = lc $ENV{COMPUTERNAME};
44 my $volume = lc $sourcePath_volume;
45 $hostname ||= "DUMMY";
46 $volume ||= "xx";
47 my $target_remote = "$remote_ssh_prefix:$remote_target_base/$hostname/$volume/";
48
49 # main - build rsync command
50 my $cmd;
51 $cmd = "$bash -c 'cd /cygdrive/$sourcePath_volume; $rsync -R -azuv -e ssh --progress \"$sourcePath\" \"$target_remote\"'";
52 print "synchronizing directories with...", "\n";
53 print "cmd: ", $cmd, "\n";
54
55 # main - run rsync
56 print `$cmd`;
57
58 print "\n";
59 print "sleeping for 1 minute...";
60 `sleep 1m`;
61

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed