Created
July 28, 2011 08:53
-
-
Save pvorb/1111238 to your computer and use it in GitHub Desktop.
Backup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This little backup script saves all data of the server
host
to an archive namedbackup_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
.