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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Use custom backup destination question

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

Tags:
  1. Santiago Botto

    Santiago Botto Registered

    Joined:
    Apr 30, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Argentina
    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:

    Code:
    #!/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 ;)
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,215
    Likes Received:
    1,759
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page