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 the rsync command on the local machine (where
32 rex is being run) to sync $source and $dest with a remote. The "rsync"
33 command is invoked with the "--recursive --links --verbose --stats"
34 options set.
35
36 If you want to use sudo, you need to disable requiretty option for this
37 user. You can do this with the following snippet in your sudoers
38 configuration.
39
40 Defaults:username !requiretty
41
42 UPLOAD - Will upload all from the local directory html to the remote
43 directory /var/www/html.
44 task "sync", "server01", sub {
45 sync "html/*", "/var/www/html", {
46 exclude => "*.sw*",
47 parameters => '--backup --delete',
48 };
49 };
50
51 task "sync", "server01", sub {
52 sync "html/*", "/var/www/html", {
53 exclude => ["*.sw*", "*.tmp"],
54 parameters => '--backup --delete',
55 };
56 };
57
58 DOWNLOAD - Will download all from the remote directory /var/www/html to
59 the local directory html.
60 task "sync", "server01", sub {
61 sync "/var/www/html/*", "html/", {
62 download => 1,
63 parameters => '--backup',
64 };
65 };
66
67
68
69perl v5.38.0 2023-08-07 Rex::Commands::Rsync(3)