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

Manually backing up files...

#1
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!
 

Tracy Perry

Well-known member
#2
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