Database support
And here is an example of tils_freeze_hook. This assumes MySQL database is located
on sdb1 partition.
#!/bin/bash
# Example of tils_freeze_hook
#
MYSQLDEV="/dev/sdb1"
HOOKLOG="/var/log/tils_freeze_hook.log"
MSQLCMD="/etc/init.d/mysqld"
function set_fd {
# prepare file descriptors 3-100 to be
# closed before launch msql
for i in `/usr/bin/seq 3 100` ; do
done
}
function is_msql_running {
${MSQLCMD} status | grep "mysqld.* running" > /dev/null 2>&1
}
function write_log {
local prefix="`/bin/date \
+%Y-%m-%dT%H%M%S%z`:tils_freeze_hook:"
echo ${prefix}$* >> $HOOKLOG
}
DEV=${1}
MODE=${2}
[ "${MYSQLDEV}" != "${DEV}" ] && exit 0
# mysql database partition affected
if [ "$MODE" == "stop" ] ; then
is_msql_running
[ ! $? -eq 0 ] && exit 0 # msql is not running \
#- nothing to do
set_fd
write_log "Backup ${DEV}. Stopping MySQL ..."
# launch "msql stop" in synchronous (foreground) mode
# because backup must wait until database stops
eval "${MSQLCMD} stop $FD > /dev/null 2>&1"
write_log "MySQL was stopped."
fi
if [ "$MODE" == "start" ] ; then
is_msql_running
[ $? -eq 0 ] && exit 0 # msql is running
set_fd
write_log "Backup ${DEV}. Starting MySQL ..."
# launch "msql start" in asynchronous (background) mode
# because backup and database start may run concurrently
eval "${MSQLCMD} start $FD > /dev/nill 2>&1 &"
# Don't write anything to logs because we don't
# know real "msql start" exit status
fi
exit 0
36
FD="$FD $i>&-"
Copyright © Acronis, Inc., 2000-2005
Need help?
Do you have a question about the TRUE IMAGE SERVER 8.0-LINUX and is the answer not in the manual?
Questions and answers