mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
* Small fixes in console print-outs * Update chart version, it was incremented since the PR
29 lines
647 B
Bash
29 lines
647 B
Bash
#!/bin/bash
|
|
|
|
export WEBDIR=/data/web
|
|
export DBDIR=/data/db
|
|
export CLONEWEBDIR=/clone_data/web
|
|
export CLONEDBDIR=/clone_data/db
|
|
if [ -n "$(ls -A $WEBDIR)" ]; then
|
|
echo "Pod already initialized, continuing..."
|
|
else
|
|
xtrabackup -uroot -p"$MYSQL_ROOT_PASSWORD" -H$MYSQL_HOST -h $CLONEDBDIR --backup --target-dir=$DBDIR
|
|
|
|
if ! [ "$?" -eq 0 ]; then
|
|
echo "Failed to generate DB backup, exiting..."
|
|
exit 1
|
|
fi
|
|
|
|
xtrabackup --prepare --target-dir=$DBDIR
|
|
rsync -avzh $CLONEWEBDIR/ $WEBDIR
|
|
|
|
if ! [ "$?" -eq 0 ]; then
|
|
echo "Failed to clone html files, exiting..."
|
|
exit 1
|
|
fi
|
|
|
|
rm "$WEBDIR/db_initialized"
|
|
|
|
echo "Successfully copied all data."
|
|
fi
|