1Rex::Commands::Rsync(3)User Contributed Perl DocumentatioRnex::Commands::Rsync(3)
2
3
4
6 Rex::Commands::Rsync - Simple Rsync Frontend
7
9 With this module you can sync 2 directories via the rsync command.
10
11 Version <= 1.0: All these functions will not be reported.
12
13 All these functions are not idempotent.
14
16 Expect
17 The Expect Perl module is required to be installed on the machine
18 executing the rsync task.
19
20 rsync
21 The rsync command has to be installed on both machines involved in
22 the execution of the rsync task.
23
25 use Rex::Commands::Rsync;
26
27 sync "dir1", "dir2";
28
30 sync($source, $dest, $opts)
31 This function executes rsync to sync $source and $dest. The "rsync"
32 command is invoked with the "--recursive --links --verbose --stats"
33 options set.
34
35 If you want to use sudo, you need to disable requiretty option for this
36 user. You can do this with the following snippet in your sudoers
37 configuration.
38
39 Defaults:username !requiretty
40
41 UPLOAD - Will upload all from the local directory html to the remote
42 directory /var/www/html.
43 task "sync", "server01", sub {
44 sync "html/*", "/var/www/html", {
45 exclude => "*.sw*",
46 parameters => '--backup --delete',
47 };
48 };
49
50 task "sync", "server01", sub {
51 sync "html/*", "/var/www/html", {
52 exclude => ["*.sw*", "*.tmp"],
53 parameters => '--backup --delete',
54 };
55 };
56
57 DOWNLOAD - Will download all from the remote directory /var/www/html to
58 the local directory html.
59 task "sync", "server01", sub {
60 sync "/var/www/html/*", "html/", {
61 download => 1,
62 parameters => '--backup',
63 };
64 };
65
66
67
68perl v5.32.1 2021-03-06 Rex::Commands::Rsync(3)