Backup Script


#!/bin/bash
#
# Backup Script
############################################
#
# Directory to backup. Use spaces to multiple directory
backup_files=”/etc”

# Directory to save the backup file
dest=”/var/backup”

# Creating a filename to the backup
#day=$(date +%A)
day=$(date +%Y_%m_%d)
hostname=$(hostname -s)
archive_file=”$hostname-$day.tgz”
startdate=$(date)

# Backup starting message
echo “Doing Backup $backup_files to $dest/$archive_file”
echo “Starting Backup on”:
date
echo

# Backup the files using tar.
tar czf $dest/$archive_file $backup_files –exclude=*backup*.tar*

# Print end status message.
echo
echo “Backup Finished”
date

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.