Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Use custom backup destination question

Discussion in 'Data Protection' started by Santiago Botto, Mar 9, 2018.

  1. Santiago Botto

    Santiago Botto Registered

    Apr 30, 2016
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    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:

    # Server name is the container to upload files to
    sServer=`hostname | awk -F. '{print $2}'`
    # 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 ;)
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice