Skip to contentSkip to conversation

Simple scripts for use in automated backups?

linux-lvm Charles Marcus 4 participants 5 messages Apr 23, 2008

lore
Share & tools
lore
#0 lore raw

Hello again,

Sorry to flood the list with newbie questions... if there is a better list for things like this, please let me know...

I'm still fairly new to linux (coming from windows world), and enjoying the freedom, but as far as scripting goes - well, to call me a noob is being kind...

Would any kind souls be willing to share some basic scripts that can be used to activate a snapshot, then 'do x' (this would be my rsnapshot command), then release the snapshot? The part that I don't have a clue about is how to check for errors - ie, did the snapshot activate ok? Did it release ok?...

Thanks for any responses, including decent how-to's, etc...

Signature · 3 lines
Best regards,

Charles
#1 lore raw
Quoted 5 lines · Charles Marcus

Would any kind souls be willing to share some basic scripts that can be
used to activate a snapshot, then 'do x' (this would be my rsnapshot command), then release the snapshot? The part that I don't have a clue about is how to check for errors - ie, did the snapshot activate ok? Did it release ok?...

Here's a few links I dug up a couple weeks ago on how people use lvm to back up mysql:

http://en.oreilly.com/mysql2008/public/schedule/detail/252
http://forum.mysqlperformanceblog.com/s/m/782/
http://lenz.homelinux.org/mylvmbackup/
http://jcole.us/blog/archives/2006/04/25/plugin-based-backup-for-mysql/
http://www.mysqlperformanceblog.com/2006/08/21/using-lvm-for-mysql-backup-and-replication-setup/

#2 lore raw
In reply to Charles Marcus
Quoted 7 lines · Charles Marcus

Hello again,

Sorry to flood the list with newbie questions... if there is a better list for things like this, please let me know...

I'm still fairly new to linux (coming from windows world), and enjoying the freedom, but as far as scripting goes - well, to call me a noob is being kind...

Would any kind souls be willing to share some basic scripts that can be used to activate a snapshot, then 'do x' (this would be my rsnapshot command), then release the snapshot? The part that I don't have a clue about is how to check for errors - ie, did the snapshot activate ok? Did it release ok?...

*Usually*, a command exits with code 0 if it finishes with a success.

In bash, you can check the exit code with $? variable.

So:

lvmcommand --option1 --option2

if [ $? -eq 0 ] ; then
do_this
else
do_that
fi

#3 lore raw
Quoted 3 lines
Quoted 1 line

Would any kind souls be willing to share some basic scripts that can be used to activate a snapshot, then 'do x' (this would be my rsnapshot command), then release the snapshot? The part that I don't have a clue about is how to check for errors - ie, did the snapshot activate ok? Did it release ok?...

*Usually*, a command exits with code 0 if it finishes with a success.

<snip>

Quoted 2 lines

Here's a few links I dug up a couple weeks ago on how people use lvm to back up mysql:

Thanks! helps a lot...

Signature · 3 lines
Best regards,

Charles
#4 lore raw
In reply to Tomasz Chmielewski
Quoted 7 lines · Tomasz Chmielewski

*Usually*, a command exits with code 0 if it finishes with a success.

In bash, you can check the exit code with $? variable.

So:

Quoted 7 lines

lvmcommand --option1 --option2

if [ $? -eq 0 ] ; then
do_this
else
do_that
fi

Even easier, the shell considers exit code 0 as "true", so the above is simply:

if lvmcommand --option1 --option2; then
do_this
else
do_that
fi

Signature · 4 lines
	      Stuart D. Gathman <[email protected]>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.