Created
April 20, 2016 14:17
-
-
Save fgbreel/408a8fa29805d67ad0e1c7337a89d684 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use DBI; | |
# Connect to the local database | |
$dbh = DBI->connect('DBI:mysql:host=localhost;database=mysql', 'root', 'password') || die; | |
# Flush and lock tables to prepare for LVM snapshot | |
$dbh->do('FLUSH TABLES WITH READ LOCK;'); | |
# Create LVM snapshot volume | |
system('lvcreate -L8G -s -n mysqlbackup /dev/vg0/mysql'); | |
# Release table lock | |
$dbh->do('UNLOCK TABLES;'); | |
# Disconnect from database | |
$dbh->disconnect(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment