Ingen beskrivning

Denis V. Dedkov 0fc6be6757 Написан README 10 månader sedan
LICENSE 2c0ce6715d Initial commit 10 månader sedan
README.md 0fc6be6757 Написан README 10 månader sedan
backup.sh 845d404f70 Добавлена проверка на наличие NAS в локальной сети 10 månader sedan

README.md

NAS Backup Script

A Bash script for automated backup to NAS using rsync with include/exclude patterns.

Features

  • ✅ Syncs files/folders to NAS
  • ✅ Supports include/exclude lists
  • ✅ Verifies NAS connection
  • ✅ Preserves directory structure
  • ✅ Detailed logging

Requirements

  • Linux/Unix system
  • rsync on both client and NAS
  • sshpass installed (sudo apt install sshpass)
  • SSH access to NAS

Installation

git clone https://gogs.dended.ru/ded/backup
cd backup
chmod +x backup.sh

Configuration

Create config files: backup_list.txt (files/folders to backup):

/home/user/Documents
/etc/nginx
~/projects

exclude_list.txt (patterns to exclude):

*.tmp
*.log
/home/user/Documents/temp/

Usage

Basic command:

./backup.sh <NAS_IP> <USER> <PASSWORD> <BACKUP_LIST> <EXCLUDE_LIST>

Example:

./backup.sh 192.168.1.100 admin mypass ~/backup_list.txt ~/exclude.txt

Scheduling with Cron

Hourly backup with logging:

0 * * * * /path/to/script.sh 192.168.1.100 admin pass /backup_list.txt /exclude.txt >> /var/log/nas_backup.log 2>&1