From: Matthijs Kooijman Date: Mon, 5 Jan 2009 15:14:55 +0000 (+0100) Subject: mysql: Interpolate the backupdir config variable. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja-vserver.git;a=commitdiff_plain;h=99fc759bcc31990e23c4bd974a65f782d3dbd917 mysql: Interpolate the backupdir config variable. --- 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