Permalink
Browse files

Renaming script and creating a temporary legacy simlink.

  • Loading branch information...
1 parent fbb53d9 commit 0b8573e0656c8ff909b84576cd03377492892d79 @fernandokosh fernandokosh committed Sep 14, 2011
Showing with 52 additions and 51 deletions.
  1. +51 −0 bin/rsyncbackup
  2. +0 −51 bin/rsyncbackup.sh
  3. +1 −0 bin/rsyncbackup.sh
View
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+backup_d="/etc/backup.d/"
+machines="machines-enabled"
+rsync_cmd="/usr/bin/rsync -razplR --delete --delete-excluded"
+
+for machine in `cat $backup_d$machines`
+do
+ echo "Backup for $machine"
+ source $backup_d$machine
+
+ if [ $destination_host != "local" ] ; then
+ destination_folder="$destination_host:$destination_folder"
+ else
+ destination_folder="$destination_folder$machine"
+ if [ ! -d $destination_folder ] ; then
+ mkdir -p $destination_folder
+ fi
+ fi
+
+ for source_folder in $source_folders
+ do
+ if [ $source_host != "local" ] ; then
+ source_folder="$source_host:$source_folder"
+ fi
+
+ exclude=""
+
+ if [ -e $backup_d$exclude_from ] ; then
+ exclude="$exclude --exclude-from=$backup_d$exclude_from"
+ fi
+
+ echo "RSync $source_folder to $destination_folder"
+ run_cmd="$rsync_cmd $exclude $source_folder $destination_folder"
+ echo $run_cmd
+ $run_cmd
+ done
+
+ if [ $source_host != "local" ] ; then
+ if [ -n "$mysql_user" ]; then
+
+ databases=`mysql --host=$source_host --user=$mysql_user --password=$mysql_pass -e 'SHOW DATABASES;' | grep -Ev '(Database|information_schema)'`
+
+ for database in $databases
+ do
+ result=`mysqldump --user=$mysql_user --password=$mysql_pass --host=$source_host --skip-opt --add-locks $database | gzip -9 > $destination_folder/$database.gz`
+ done
+ fi
+ fi
+done
+echo "Done"
View
@@ -1,51 +0,0 @@
-#!/bin/bash
-
-backup_d="/etc/backup.d/"
-machines="machines-enabled"
-rsync_cmd="/usr/bin/rsync -razplR --delete --delete-excluded"
-
-for machine in `cat $backup_d$machines`
-do
- echo "Backup for $machine"
- source $backup_d$machine
-
- if [ $destination_host != "local" ] ; then
- destination_folder="$destination_host:$destination_folder"
- else
- destination_folder="$destination_folder$machine"
- if [ ! -d $destination_folder ] ; then
- mkdir -p $destination_folder
- fi
- fi
-
- for source_folder in $source_folders
- do
- if [ $source_host != "local" ] ; then
- source_folder="$source_host:$source_folder"
- fi
-
- exclude=""
-
- if [ -e $backup_d$exclude_from ] ; then
- exclude="$exclude --exclude-from=$backup_d$exclude_from"
- fi
-
- echo "RSync $source_folder to $destination_folder"
- run_cmd="$rsync_cmd $exclude $source_folder $destination_folder"
- echo $run_cmd
- $run_cmd
- done
-
- if [ $source_host != "local" ] ; then
- if [ -n "$mysql_user" ]; then
-
- databases=`mysql --host=$source_host --user=$mysql_user --password=$mysql_pass -e 'SHOW DATABASES;' | grep -Ev '(Database|information_schema)'`
-
- for database in $databases
- do
- result=`mysqldump --user=$mysql_user --password=$mysql_pass --host=$source_host --skip-opt --add-locks $database | gzip -9 > $destination_folder/$database.gz`
- done
- fi
- fi
-done
-echo "Done"
View

0 comments on commit 0b8573e

Please sign in to comment.