Skip to content

Instantly share code, notes, and snippets.

@rhamdeew
Created August 5, 2014 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhamdeew/3bd7f20e10d04a7dd7b2 to your computer and use it in GitHub Desktop.
Save rhamdeew/3bd7f20e10d04a7dd7b2 to your computer and use it in GitHub Desktop.
Backup script for selectel with split large files (+4Gb)
#!/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