Automated Server Backup with Rsync and Notifications - n8n Workflow

Use this robust n8n workflow to automate secure Rsync backups between source and target servers using password authentication (sshpass) and receive instant status alerts via Telegram and SMS.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

A Markdown-formatted string containing a bulleted list.
DevOps Engineers and System Administrators needing reliable, automated server backup solutions.
Users who require password-based SSH authentication for script execution, where SSH keys are not feasible.
Anyone looking for an advanced n8n template demonstrating complex external command execution and error handling.
Businesses requiring instant status alerts (success or failure) for critical server synchronization tasks.

Overview

Server backups are critical, but managing dependencies and executing complex, multi-stage commands can be challenging. This specialized n8n workflow solves this by fully automating the Rsync process. It intelligently checks if necessary tools (sshpass and rsync) are installed on both the local n8n machine and the source server, installing them automatically across various Linux distributions (Ubuntu, RHEL, Alpine) if missing. The core logic uses a double sshpass connection to execute rsync from the source server directly to the target server, ensuring data transfer efficiency. The entire operation is wrapped in robust error handling, guaranteeing that regardless of success or failure, a detailed status report is generated and delivered via Telegram and SMS. This powerful n8n node combination turns complex sysadmin tasks into reliable, hands-off automation.

How it Works

A Markdown-formatted string containing a step-by-step explanation.


  1. Trigger Initiation: The n8n workflow starts via a Manual Trigger or a Schedule Trigger (for recurring daily or hourly backups).

  2. Configuration Loading: The 'Server Parameters' n8n node loads all necessary connection details: source/target hosts, ports, usernames, sensitive passwords, folders, and Rsync options.

  3. Local Dependency Check: The n8n workflow checks if sshpass is installed locally on the machine hosting n8n. If the exit code is non-zero, the 'Install Sshpass Local' n8n node runs platform-specific commands to install both sshpass and rsync.

  4. Source Server Dependency Check: The workflow then uses sshpass to connect to the source server and checks for sshpass installation there. If needed, the 'Install Sshpass on Source' n8n node installs the dependencies remotely using sudo on the source server.

  5. Rsync Execution: The 'Execute Rsync Backup' n8n node connects to the source server and executes a nested command. This command uses sshpass and rsync to pull data from the source folder and push it directly to the target server, bypassing the n8n machine for data transfer.

  6. Status Evaluation: The 'Success?' n8n node evaluates the command's exit code. A 0 indicates success, leading to the 'Backup Successful' branch.

  7. Reporting: Detailed status information (including timestamps, sources, targets, and output logs) is prepared using set n8n node structures.

  8. Notification: The final 'Process Finish Report' n8n node uses curl commands to send the resulting status message instantly via Telegram and SMS (Textbelt), completing the n8n template execution.

Installation Guide

A Markdown-formatted string containing installation instructions.


  1. Import: Copy the provided n8n workflow JSON and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Configure Parameters: Locate the 'Server Parameters' n8n node. You must replace all placeholder values for sourcehost, sourceuser, sourcepassword, targethost, targetuser, and targetpassword with your actual server credentials.

  3. Notification Setup: Locate the 'Process Finish Report --- Telegam & SMS' n8n node. Edit the Execute Command body and replace the following placeholders:

YOUR-TELEGRAM-BOT-TOKEN and YOUR-TELEGRAM-CHANNEL-ID.
The placeholder phone numbers (+36301234567).
* YOUR-TEXTBELT-API-KEY (if using SMS). Alternatively, delete the Textbelt lines if only using Telegram.

  1. Activation: Activate the n8n workflow. Use the Schedule Trigger to set the backup frequency or run manually.

Node Details

A Markdown-formatted string listing node details.

Schedule Trigger / Manual Trigger n8n trigger: Starts the n8n workflow execution, allowing for either scheduled recurring backups or manual runs.
Server Parameters (Set n8n node): Stores all configuration variables (usernames, passwords, IPs, paths) for the source and target servers. This makes configuration centralized and reusable throughout the n8n template.
Check Sshpass Local / Check Sshpass on Source (Execute Command n8n node): Executes which sshpass locally and remotely via SSH. These crucial steps determine if dependency installation is required before proceeding with the backup.
Install Sshpass Local / Install Sshpass on Source (Execute Command n8n node): Contains conditional logic using Bash if/elif statements to automatically install sshpass and rsync based on detected package managers (apt, yum, dnf, apk).
Execute Rsync Backup (Execute Command n8n node): The core mechanism. It uses a single command string to chain two sshpass authentications, executing the rsync command on the source server to transfer data directly to the target.
Success? (If n8n node): Checks the exitCode from the Rsync execution. If 0 (success), it follows the positive path; otherwise, it branches to failure reporting.
Backup Successful / Backup Failed (Set n8n node): Standardizes the output structure, collecting logs (stdout or stderr) and assigning a clear status label before sending the final alert.
Process Finish Report (Execute Command n8n node): Uses curl to send formatted alerts containing the full status report, ensuring administrators are immediately notified of the outcome of this complex n8n workflow.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by
Vigh Sandor
Vigh Sandor

Featured*