]> git.parisson.com Git - clone-me.git/commitdiff
add local backup
authoryomguy <yomguy@parisson.com>
Sun, 20 Jul 2014 13:21:51 +0000 (15:21 +0200)
committeryomguy <yomguy@parisson.com>
Sun, 20 Jul 2014 13:21:51 +0000 (15:21 +0200)
tc_backup_local.sh [new file with mode: 0755]

diff --git a/tc_backup_local.sh b/tc_backup_local.sh
new file mode 100755 (executable)
index 0000000..89d53f5
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -e
+
+echo "Please enter the MASTER_PATH:"
+read MASTER_PATH
+
+echo "Please enter the BACKUP_PATH:"
+read BACKUP_PATH
+
+CLONE=$BACKUP_PATH
+
+if [ ! -d $CLONE ]; then
+ sudo mkdir $CLONE
+fi
+
+# CLONING
+echo "rsyncing root..."
+sudo rsync -a --delete --exclude "/var/*" --exclude "/home/*" --one-file-system $MASTER_PATH/ $CLONE/
+
+echo "rsyncing var..."
+DEST=$CLONE/var
+if [ ! -d $DEST ]; then
+ sudo mkdir $DEST
+fi
+sudo rsync -a --one-file-system --delete $MASTER_PATH/var/ $CLONE/var/
+
+echo "rsyncing home..."
+DEST=$CLONE/home
+if [ ! -d $DEST ]; then
+ sudo mkdir $DEST
+fi
+sudo rsync -a --one-file-system --exclude "archives/*" --exclude "trash/*" --exclude "test/*" $MASTER_PATH/home/ $CLONE/home/
+
+echo "$MASTER_PATH has been backup to $BACKUP_PATH ! :)"