1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Manually backing up files...

Discussion in 'Server Configuration and Hosting' started by click here, Jun 14, 2016.

  1. click here

    click here Active Member

    Newb question, what is a simple command line syntax for backing up my forums and compressing them (dedicated unix server), not the database, just the xenforo files and attachment directory etc. so I can download to my home computer?

    Thanks!
     
  2. Tracy Perry

    Tracy Perry Well-Known Member

    This is a script I use. Just copy it in a text file with an .sh extension, make it executable and place it in /usr/local/sbin

    Code:
    #!/bin/sh
    ####################################
    #
    # Backup to local directory
    #
    ####################################
    
    # What to backup.
    backup_files="/path/to/your/files"
    
    # Where to backup to.
    dest="/path/to/save/backups/to"
    
    # Create archive filename.
    #  This will be in the format of hostname-forum-Day of Week.zip.
    
    day=$(date +%A)
    hostname=$(hostname -s)
    archive_file="custom_name-$day.zip"
    
    # Print start status message.
    echo "Backing up $backup_files to $dest/$archive_file"
    date
    echo
    
    # Backup the files using zip.
    zip -r -q $dest/$archive_file $backup_files
    
    # Print end status message.
    echo
    echo "Backup finished"
    date
    
     
    Mouth and RoldanLT like this.
  3. Mouth

    Mouth Well-Known Member

    tar cvfz /path/to/xenforo/ my-xenforo-backup.tar.gz
     

Share This Page