.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Rex::Commands::Rsync 3pm" .TH Rex::Commands::Rsync 3pm "2018-02-01" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Rex::Commands::Rsync \- Simple Rsync Frontend .SH "DESCRIPTION" .IX Header "DESCRIPTION" With this module you can sync 2 directories via the \fIrsync\fR command. .PP Version <= 1.0: All these functions will not be reported. .PP All these functions are not idempotent. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" .IP "Expect" 4 .IX Item "Expect" The \fIExpect\fR Perl module is required to be installed on the machine executing the rsync task. .IP "rsync" 4 .IX Item "rsync" The \fIrsync\fR command has to be installed on both machines involved in the execution of the rsync task. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Rex::Commands::Rsync; \& \& sync "dir1", "dir2"; .Ve .SH "EXPORTED FUNCTIONS" .IX Header "EXPORTED FUNCTIONS" .ie n .SS "sync($source, $dest, $opts)" .el .SS "sync($source, \f(CW$dest\fP, \f(CW$opts\fP)" .IX Subsection "sync($source, $dest, $opts)" This function executes rsync to sync \f(CW$source\fR and \f(CW$dest\fR. .PP If you want to use sudo, you need to disable \fIrequiretty\fR option for this user. You can do this with the following snippet in your sudoers configuration. .PP .Vb 1 \& Defaults:username !requiretty .Ve .IP "\s-1UPLOAD\s0 \- Will upload all from the local directory \fIhtml\fR to the remote directory \fI/var/www/html\fR." 4 .IX Item "UPLOAD - Will upload all from the local directory html to the remote directory /var/www/html." .Vb 6 \& task "sync", "server01", sub { \& sync "html/*", "/var/www/html", { \& exclude => "*.sw*", \& parameters => \*(Aq\-\-backup \-\-delete\*(Aq, \& }; \& }; \& \& task "sync", "server01", sub { \& sync "html/*", "/var/www/html", { \& exclude => ["*.sw*", "*.tmp"], \& parameters => \*(Aq\-\-backup \-\-delete\*(Aq, \& }; \& }; .Ve .IP "\s-1DOWNLOAD\s0 \- Will download all from the remote directory \fI/var/www/html\fR to the local directory \fIhtml\fR." 4 .IX Item "DOWNLOAD - Will download all from the remote directory /var/www/html to the local directory html." .Vb 6 \& task "sync", "server01", sub { \& sync "/var/www/html/*", "html/", { \& download => 1, \& parameters => \*(Aq\-\-backup\*(Aq, \& }; \& }; .Ve