Script

Backup Shell Script for Drupal (Linux OS)

#!/bin/sh
####################################
#
# Drupal Backup script.
#
####################################

# What to backup.
backup_files="/var/www/myfolder"

# Where to backup to.
dest="/home/backup_myfolder/files"

# Create archive filename.
day=$(date +%m-%d-%Y)
archive_file="myfolder-$day.tgz"

# Print start status message.
echo "Backing up $backup_files to $dest/$archive_file"
date
echo

# Backup the files using tar.
tar czf $dest/$archive_file $backup_files