Use custom backup destination question
Hi! I have the following script that transfers all backup files from the local server to a remote Rackspace CloudFiles container, but I want to integrate it to cPanel's backup tool, so that I can upload each backup file as soon as the server finishes its creation and delete it after a successful upload.
I've read the docs (How to Create a Custom Destination - Version 66 Documentation - cPanel Documentation and Custom Backup Destination Guide - Version 66 Documentation - cPanel Documentation) but I still don't get how can I fuse my script with cPanel's backup tool (maybe due to my lack of knowledge on Perl...).
My script:
I hope someone can help me! Thanks ;)
#!/bin/bash
# Server name is the container to upload files to
sServer=`hostname | awk -F. '{print $2}'`
sContainer=$sServer
# Get the name of the local backup directory (the date that last the backup was created on)
sBackupDate=`find /backup/ -maxdepth 1 -type d ! -name "backup" -printf "%T+\t%p\n" | sort -r | awk '{print $2}' | awk -F/ '{print $3}' | head -n 1`
# Create an alphabetically-sorted list of the backup files to upload
find /backup/$sBackupDate/accounts/ -name "*.tar.gz" | sort > /root/tmp_backup_files_list.txt
# Upload each backup file on the list we've just created
while read -r sBackupFile ; do
sFile=`basename $sBackupFile`
swiftly --conf /auto-scan/.swiftly-ord.conf --concurrency 100 put -i /backup/$sBackupDate/accounts/$sFile /$sContainer/$sBackupDate/$sFile
done < "/root/tmp_backup_files_list.txt"
I hope someone can help me! Thanks ;)
Please sign in to leave a comment.
Comments
0 comments