#!/bin/bash

# A script to run inside MariaDB client to be called from inside the mariadb client inside the container in order to wait for snapshot taken by checking the existing of $SNAPSHOT_TAKEN_SIGNAL_FILE


# a directory for synchronization between main script(nc_snapshot.sh) and this script inside the container
export SYNC_DIRECTORY='/snapshot_sync'
# a tmp file the signal of snapshot taken.
# the existence of the file means snapshot has been taken.
export SNAPSHOT_TAKEN_SIGNAL_FILE="${SYNC_DIRECTORY}/nc_snapshot_taken.txt"

while true
do
	if [ -e "$SNAPSHOT_TAKEN_SIGNAL_FILE" ]
	then
		break
	fi
	sleep 1
done
