summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbackup-mysql16
1 files changed, 8 insertions, 8 deletions
diff --git a/backup-mysql b/backup-mysql
index f6ad2ac..b964833 100755
--- a/backup-mysql
+++ b/backup-mysql
@@ -6,17 +6,20 @@
# All rights reserved.
#
-echo "Does not handle per client backup dir" >&2
-exit 1
-
umask 037
set -e
set -u
DATE=`date "+%Y%m%d-%H%M%S"`
-TARGET=/var/backups/local/mysql
-[ -d $TARGET ] || mkdir -p $TARGET
+if [ -d /var/backups/local/mysql ]; then
+ TARGET=/var/backups/local/mysql
+elif [ -d /var/local/backup/mysql ]; then
+ TARGET=/var/local/backup/mysql
+else
+ echo "Cannot find a backup target directory" >&2
+ exit 1
+fi
echo 'SHOW DATABASES;' | mysql | tail -n +2 |
while read db; do
@@ -36,6 +39,3 @@ while read db; do
ln "$file.bz2" "$TARGET/MD5-$md5"
fi
done | egrep -v 'Database ".*" dropped'
-
-# clean up old stuff
-find "$TARGET" -name 'MD5-*' -links 1 -print0 | xargs --no-run-if-empty rm --