Created
August 5, 2014 12:03
-
-
Save rhamdeew/3bd7f20e10d04a7dd7b2 to your computer and use it in GitHub Desktop.
Backup script for selectel with split large files (+4Gb)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#sync directories struct | |
rsync -a --include='*/' --exclude='*' /var/backups/local/ /var/backups/selectel | |
find /var/backups/local/ -name "admin-1_full*" -mtime -7 -size -4000M > /tmp/small_files.lst | |
for i in `cat /tmp/small_files.lst`; do ln -s $i `echo $i | sed 's/local/selectel/g'`; done; | |
find /var/backups/local/ -name "admin-1_full*" -mtime -7 -size +4000M > /tmp/large_files.lst | |
for i in `cat /tmp/large_files.lst`; do split --bytes=4000m $i `echo $i | sed 's/local/selectel/g'`; done; | |
rm /tmp/small_files.lst | |
rm /tmp/large_files.lst |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment