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!

archive your daily backups

Discussion in 'General Discussion' started by smoge, Jan 1, 2007.

  1. smoge

    smoge Well-Known Member

    Jul 2, 2004
    Likes Received:
    Trophy Points:
    If you are running WHM you may want to use a script like this to archive your daily backups - since WHM overwrites the previous daily resulting in no daily history.

    You can do this several other ways than this script - but this works fine if you watch the disk space on your server and clean things up as needed.

    I don't login here much - so I will maintain the script here on ModMySite:

    If you have problems/questions - reach me on ModMySite as "smoge".

    # ModMySite - Script Collection -
    # Backup Script For Archiving WHM Daily Backups to daily_archive directory
    # Save this script in /root/scripts and call it
    # chmod +x
    # Create a daily_archive directory in whm backup directory
    # Command line param is path to whm backup directory
    # example is
    # /root/scripts/ /backup/
    # Set a cron job to run a few hours after your WHM backup runs
    # Example cron job:
    # 0 10 * * * /root/scripts/ /backup/
    THISRUN=`date +%m_%d_%y_%H`
    echo ------ Backing up ${1}cpbackup/daily on ${THISRUN} ------
    echo Changing to ${1} directory.
    cd ${1}
    echo Directory change complete.
    echo Creating archive of
    echo ${1}cpbackup/daily to ${1}daily_archive directory.
    echo Performing file compression.
    tar -cvzf ${1}daily_archive/${THISRUN}_cpdaily.tar.gz ${1}cpbackup/daily &
    echo Wating for file compression.
    echo File compression done.
    echo ---
    echo Disk space report
    echo This is overall system space not user specific.
    df -h
    echo ---
    echo Listing ${1}daily_archive directory contents
    ls ${1}daily_archive -l
    echo ---
    ## Copying file to backup server
    ## scp ${1}daily_archive/${THISRUN}_cpdaily.tar.gz username@111.222.333.4441:${THISRUN}_cpdaily.tar.gz
    ## echo ---
    echo Done.

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