---
title: "Very simple Linux backup"
date: "2009-01-01"
modified: "2013-03-03"
path: "/9-very-simple-linux-backup.html"
section: "/ramblings"
aliases:
  - "/9"
  - "/9-very-simple-linux-backup"
  - "/9.html"
  - "/ramblings/9-very-simple-linux-backup.html"
---

This script will simply copy a series of files, tar and then gzip the files:

```bash
#!/bin/sh
# temporary backup script
Back_Dir="/root/scripts/backups" 
Vhosts_Dir="/home/httpd/vhosts" 

# get the date for the filename.
shdate=`date +%b%d%y`

# save our current directory location.
tmp_dir=$PWD

# change to the Backup file directory.
cd $Back_Dir

# create a gzip compressed tar file of the webs directory.
tar -czf ${shdate}.bak.tar.gz $Vhosts_Dir

# return to the previous working directory.
cd $tmp_dir
```

It might help a few users!
