1 |
#!/bin/sh |
2 |
|
3 |
# Initialization |
4 |
PATH_TO_FILE=${PATH_TO_FILE:-<%= blog_db_backupdir %>} |
5 |
[ ! -f $PATH_TO_FILE/count ] && echo 0 > $PATH_TO_FILE/count |
6 |
COUNT=$(cat "$PATH_TO_FILE/count") |
7 |
# Backup each locale DB |
8 |
for locale in de el en es fr it nl pl pt ro ru tr uk |
9 |
do |
10 |
if [ ! -d $PATH_TO_FILE/$locale ] |
11 |
then |
12 |
/bin/mkdir $PATH_TO_FILE/$locale |
13 |
fi |
14 |
/usr/bin/mysqldump --add-drop-table -h localhost blog_$locale | bzip2 -c > $PATH_TO_FILE/$locale/mageia_$locale-$COUNT.bak.sql.bz2 |
15 |
done |
16 |
# Check count file to have a week of backup in the directory |
17 |
if [ $COUNT -ne 6 ] |
18 |
then |
19 |
COUNT=$(expr $COUNT + 1) |
20 |
else |
21 |
COUNT="0" |
22 |
fi |
23 |
echo $COUNT > $PATH_TO_FILE/count |