[linux-lvm] Simple scripts for use in automated backups?
Tomasz Chmielewski
mangoo at wpkg.org
Wed Apr 23 13:35:11 UTC 2008
Charles Marcus schrieb:
> 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
More information about the linux-lvm
mailing list