|
|
@@ -1,2 +1,57 @@
|
|
|
-# backup
|
|
|
+# 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
|
|
|
+```bash
|
|
|
+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:
|
|
|
+```bash
|
|
|
+./backup.sh <NAS_IP> <USER> <PASSWORD> <BACKUP_LIST> <EXCLUDE_LIST>
|
|
|
+```
|
|
|
+Example:
|
|
|
+```bash
|
|
|
+./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
|
|
|
+```
|