Skip to content

Instantly share code, notes, and snippets.

@pvorb
Created July 28, 2011 08:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvorb/1111238 to your computer and use it in GitHub Desktop.
Save pvorb/1111238 to your computer and use it in GitHub Desktop.
Backup script
#!/bin/bash
# Sichert die Dateien auf host
DIR="tmp"
if [ -d $DIR ]; then
cd $DIR
else
mkdir $DIR
cd $DIR
fi
NOW=$(date +"%Y-%m-%d_%H-%M")
BACKUPFILE="backup_$NOW.tar.bz2"
rsync -avzP -e ssh user@host:/ .
tar -vcjf $BACKUPFILE ./
mv $BACKUPFILE ../
cd ..
rm -rf $DIR
@pvorb
Copy link
Author

pvorb commented Jul 28, 2011

This little backup script saves all data of the server host to an archive named backup_YYYY-MM-DD_hh-mm.tar.bz2. Simple as it could be.

You must enable SSH access to the server before running this script. Ensure you can ssh user@host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment