[mylvmbackup] suffix proposal
- From: "Boehm, Matthew" <mboehm@xxxxxxxxxxxxx>
- To: <mylvmbackup@xxxxxxxxxxxxx>
- Date: Fri, 5 Sep 2008 11:34:24 -0500
Change the forced "_mysql" suffix on the resultant .tar.gz filename to
be user configurable. In our case, we don't want it there at all. It's
redundant.
The alternative to this is to simply remove the hardcoded '_mysql' from
line 135-ish, and add that to the default $datefmt pattern.
Or replace $datefmt as $suffix.
[root@15000Dmys01 trunk]# bzr diff
=== modified file 'trunk/mylvmbackup.conf'
--- trunk/mylvmbackup.conf 2008-09-03 19:42:21 +0000
+++ trunk/mylvmbackup.conf 2008-09-05 16:30:23 +0000
@@ -52,6 +52,7 @@
[misc]
backuptype=tar
prefix=backup
+suffix=_mysql
tararg=cvzf
tarsuffixarg=
rsyncarg=-avWP
=== modified file 'trunk/mylvmbackup.pl.in'
--- trunk/mylvmbackup.pl.in 2008-09-03 20:06:47 +0000
+++ trunk/mylvmbackup.pl.in 2008-09-05 16:30:06 +0000
@@ -62,6 +62,7 @@
my $port;
my $backuptype;
my $prefix;
+my $suffix;
my $relpath;
my $socket;
my $rsync;
@@ -115,6 +116,7 @@
# Clean up directory inputs
$prefix = clean_dirname($prefix);
+$suffix = clean_dirname($suffix);
$mountdir = clean_dirname($mountdir);
$backupdir = clean_dirname($backupdir);
@@ -123,7 +125,7 @@
$backuplv = $lvname.'_snapshot' if length($backuplv) == 0;
my $date = time2str($datefmt, time);
-my $fullprefix = $prefix.'-'.$date;
+my $fullprefix = $prefix.'-'.$date.$suffix;
my $topmountdir = $mountdir;
@@ -135,7 +137,7 @@
my $mycnf_basename = File::Basename::basename($mycnf);
my $mycnf_filename = $posdir.'/'.$fullprefix.'_'.$mycnf_basename;
# No .tar.gz on the end!
-my $archivename = $backupdir.'/'.$fullprefix.'_mysql';
+my $archivename = $backupdir.'/'.$fullprefix;
my $mounted = 0;
my $posmounted = 0;
@@ -280,6 +282,7 @@
$backuptype=$cfg->val ('misc', 'backuptype', $backuptype);
$prefix=$cfg->val ('misc', 'prefix', $prefix);
+ $suffix=$cfg->val ('misc', 'suffix', $suffix);
$datefmt=$cfg->val ('misc', 'datefmt', $datefmt);
$innodb_recover=$cfg->val ('misc', 'innodb_recover',
$innodb_recover);
$pidfile=$cfg->val ('misc', 'pidfile', $pidfile);
@@ -339,6 +342,7 @@
# misc
"backuptype=s" => \$backuptype,
"prefix=s" => \$prefix,
+ "suffix=s" => \$suffix,
"datefmt=s" => \$datefmt,
"innodb_recover" => \&innodb_recover,
"pidfile=s" => \$pidfile,
@@ -397,6 +401,7 @@
# misc
$backuptype='tar';
$prefix='backup';
+ $suffix='_mysql';
$datefmt='%Y%m%d_%H%M%S';
$innodb_recover=0;
$pidfile = '/var/tmp/mylvmbackup_recoverserver.pid';
@@ -691,6 +696,7 @@
--lvsize=<size> Size for snapshot volume (def: $lvsize)
--prefix=<prefix> Prefix for naming the backup (def:
$prefix)
+ --suffix=<suffix> Suffix for naming the backup (def:
$suffix)
--backupdir=<dirname> Path for archives (def: $backupdir)
--backuptype=(tar|rsync|none) Select backup type: tar, rsync or no
backup
Matthew Boehm
Senior MySQL DBA, The Planet - Northstar Managed Hosting
Certified MySQL 5.0 DBA
Office: 281-714-4018
Mobile: 832-253-8258
Email: mboehm@xxxxxxxxxxxxx
Other related posts:
- » [mylvmbackup] suffix proposal