Rex::C...:Rsync(3pm)

πŸ’– Rex::Commands::Rsync β€” the manual, but make it cute πŸ’–

okay so bestie, welcome to Rex::Commands::Rsync (you'll see it filed under Rex::C...:Rsync(3pm) in the docs, the name got a lil truncated, it's giving ctrl+c energy, we move πŸ’…). It's a Simple Rsync Frontend and honestly? iconic.


✨ NAME ✨

Rex::Commands::Rsync β€” Simple Rsync Frontend πŸ¦‹


🌸 DESCRIPTION 🌸

With this module you can sync 2 directories via the rsync command. that's the whole vibe. two dirs, one command, slay. πŸ’–

Version <= 1.0: All these functions will not be reported. so if you're on the old version, no receipts, no nothing, we don't talk about her πŸ™ˆ

Also important, no cap: All these functions are not idempotent. like, running them again is not the same as running them once. it's giving "chaotic", it's giving "she does what she wants". be aware. πŸ’€


πŸŽ€ DEPENDENCIES πŸŽ€

  • Expect β€” the Expect Perl module is required to be installed on the machine executing the rsync task. no Expect, no rsync task, periodt.
  • rsync β€” the rsync command has to be installed on both machines involved in the execution of the rsync task. both of them. like, both. πŸ‘‘

⭐ SYNOPSIS ⭐

use Rex::Commands::Rsync;

sync "dir1", "dir2";

literally that. two lines and you're synced. ✨


πŸ‘‘ EXPORTED FUNCTIONS πŸ‘‘

🧚 sync($source, $dest, $opts)

This function executes the rsync command on the local machine (where rex is being run) to sync $source and $dest with a remote. the rsync command is invoked with the --recursive --links --verbose --stats options set. yeah, all four, automatically, she's thorough like that. πŸ’…

If you want to use sudo, you need to disable the requiretty option for this user. You can do this with the following snippet in your sudoers configuration. (yes bestie, sudoers, the scary file, be careful in there 🫢)

Defaults:username !requiretty

🌈 UPLOAD β€” will upload all from the local directory html to the remote directory /var/www/html

task "sync", "server01", sub {
  sync "html/*", "/var/www/html", {
   exclude => "*.sw*",
   parameters => '--backup --delete',
  };
};
task "sync", "server01", sub {
  sync "html/*", "/var/www/html", {
   exclude => ["*.sw*", "*.tmp"],
   parameters => '--backup --delete',
  };
};

not me showing you two whole ways to do the exclude πŸ’– one string, or a whole array of patterns β€” she contains multitudes. πŸ¦‹


🌸 DOWNLOAD β€” will download all from the remote directory /var/www/html to the local directory html

task "sync", "server01", sub {
  sync "/var/www/html/*", "html/", {
   download => 1,
   parameters => '--backup',
  };
};

see how the download => 1 flips the whole thing around? main character energy fr fr. πŸ”₯


heads up bestie: when the function does stuff, it doesn't report it, and it isn't idempotent β€” we said it once but it's that important. read it again. πŸ’€

that's the whole manual, you ate it, you're welcome 🫢

perl v5.40.1 πŸ“ 2025-10-03 πŸŽ€ and that's the tea β€” Rex::Commands::Rsync(3pm), out. πŸ’œ

πŸ“¦ where this page comes from