image

Automated Snapshot Script for Web Server Admins

[<Back>] [<Edit>]

Backs up your Document or htdoc folder and all Database on your mySQL server

#!/bin/sh  

BACKUP_DIR=/put/your/backup/directory/here
SNAPSHOT_DIR=/put/your/Snapshot/directory/here/Archives
WEB_DIR=/put/your/WebDirectory/Here

mysqldump -u<user> -p<password> --all-databases > $BACKUP_DIR/SQL_DB/$(eval date +%Y-%m-%d-TIME-%H%M).sql
rsync -avru --progress --exclude "dontbackup" --delete $WEB_DIR/ $BACKUP_DIR/Documents/

        rm -rf $SNAPSHOT_DIR/Dialy.3
        rsync -avru --progress --delete $SNAPSHOT_DIR/Daily.2/ $SNAPSHOT_DIR/Daily.3/
        rsync -avru --progress  --delete $SNAPSHOT_DIR/Daily.0/ $SNAPSHOT_DIR/Daily.1/
        rsync -avru --progress  --delete $BACKUP_DIR/Documents $SNAPSHOT_DIR/Daily.0/

rsync -avru --progress --delete $BACKUP_DIR/Documents $SNAPSHOT_DIR/Daily.0/

#now all you have to do is add this script to Cron



By: Ted Simbajon





 
Instagram Stats
pinoy
my Kung Fu