Christophe CasalegnoAutoimmune warrior, Entrepreneur & Bio/Hacker

SxSync: remote file synchronisation in Bash with rsync / SSH

SxSync

SxSync is a GPL-licensed Bash script for efficiently synchronising files or directories with `rsync` over SSH.
It supports exclusions, logging and dry-run mode, and allows synchronisation **in both directions**: to or from a remote machine (antesync and retrosync).

Main features

– Secure synchronisation with `rsync` over SSH.
– `antesync` (push) and `retrosync` (pull) modes.
– Supports customisable exclusions (`exclude.txt` by default, or set through a variable).
– Automatically logs operations (`~/sxsync.log`, or a custom location).
– `–dry-run` option to simulate synchronisation without actually transferring anything.
– Supports custom SSH ports.
– Colour-coded OK/ERROR status feedback.

Usage

sxsync antesync <user> <ip> <local_dir> <remote_dir> <ssh_port> [--dry-run]
sxsync retrosync <user> <ip> <remote_dir> <local_dir> <ssh_port> [--dry-run]

Examples:

Push to a remote server:

sxsync antesync brain 192.168.1.100 /home/brain/ /srv/backup/ 65022

Pull from a remote server:

sxsync retrosync brain 192.168.1.100 /srv/backup/ /home/brain/ 65022

Dry run to check what would be synchronised:

sxsync antesync brain 192.168.1.100 /home/brain/ /srv/backup/ 65022 --dry-run

Customisable variables

– EXCLUDE_FILE: list of patterns to exclude (exclude.txt by default)
– SXSYNC_LOG: log file path (~/sxsync.log by default)

Todo list

– Generate an HTML or Markdown report after synchronisation.
– Add a `–no-delete` option to disable deletion at the destination.
– Add a `–silent` mode (no output except for critical errors).
– Explicit compatibility with cron/systemd for scheduled synchronisation.

Resources

– Script: sxsync.sh

—
Christophe Casalegno
You can follow me on: Telegram | Facebook | LinkedIn | X | YouTube | Twitch

Christophe Casalegno Brain 0verride

Keep it simple
and direct!