|
|
9 tháng trước cách đây | |
|---|---|---|
| LICENSE | 10 tháng trước cách đây | |
| README.md | 10 tháng trước cách đây | |
| backup.sh | 10 tháng trước cách đây | |
| restore.sh | 9 tháng trước cách đây |
A Bash script for automated backup to NAS using rsync with include/exclude patterns.
rsync on both client and NASsshpass installed (sudo apt install sshpass)git clone https://gogs.dended.ru/ded/backup
cd backup
chmod +x backup.sh
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/
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
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