From 99fc759bcc31990e23c4bd974a65f782d3dbd917 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Mon, 5 Jan 2009 16:14:55 +0100 Subject: [PATCH] mysql: Interpolate the backupdir config variable. --- examples/example.mysql | 2 ++ handlers/mysql.in | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/example.mysql b/examples/example.mysql index de9651f..5fbf009 100644 --- a/examples/example.mysql +++ b/examples/example.mysql @@ -65,6 +65,8 @@ compress = yes # backupdir = < path/to/destination > (default = /var/backups/mysql) # where to dump the backups. hotcopy backups will be in a subdirectory # 'hotcopy' and sqldump backups will be in a subdirectory 'sqldump' +# This variable is interpolated, see backup.d (5) for which variables are +# available. # # hotcopy = < yes | no > (default = no) # make a backup of the actual database binary files using mysqlhotcopy. diff --git a/handlers/mysql.in b/handlers/mysql.in index 316c109..a6cd023 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -57,14 +57,18 @@ if [ $usevserver = yes ]; then else vroot="" vexec="" + vsname="" fi +interpolated=`interpolate "$backupdir" "$vsname"` + # create backup dirs, $vroot will be empty if no vsname was specified # and we will instead proceed to operate on the host -[ -d $vroot$backupdir ] || mkdir -p $vroot$backupdir -[ -d $vroot$backupdir ] || fatal "Backup directory '$vroot$backupdir'" -hotdir="$backupdir/hotcopy" -dumpdir="$backupdir/sqldump" +[ -d $vroot$interpolated ] || mkdir -p $vroot$interpolated +[ -d $vroot$interpolated ] || fatal "Backup directory '$vroot$backupdir'" + +hotdir="$interpolated/hotcopy" +dumpdir="$interpolated/sqldump" [ "$sqldump" == "no" -o -d $vroot$dumpdir ] || mkdir -p $vroot$dumpdir [ "$hotcopy" == "no" -o -d $vroot$hotdir ] || mkdir -p $vroot$hotdir -- 2.30.2