How to backup your linux VPS

by Manoj 2012-04-21 15:51:43

Backup script for vps

#!/bin/sh
------------
#
# Backup to NFS mount script.
#
------------

# What to backup.
backup_files="/"

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

# Create archive filename.
day=$(date +%A)
hostname=$(hostname -s)
archive_file="$hostname-$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

# Print end status message.
echo
echo "Backup finished"
date

# Long listing of files in $dest to check file sizes.
ls -lh $dest
1087
like
0
dislike
0
mail
flag

You must LOGIN to add comments