LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-02-2013, 05:25 AM   #1
himpierre
LQ Newbie
 
Registered: Jun 2013
Posts: 2

Rep: Reputation: Disabled
bash: check periodically until 'virsh blockjob dom vda' shows 100% completion


Hello.

It seems we can make backups of kvm machines now with blockcopy. Does someone has an idea how to make a shellscript which does the following?:

> virsh dumpxml --security-info dom > dom.xml
> virsh undefine dom
> virsh blockcopy dom vda /path/to/backup-vda
> polling loop - check periodically until 'virsh blockjob dom vda'
> shows 100% completion
> virsh suspend dom
> virsh save dom /path/to/memory-backup --running
> virsh blockjob dom vda --abort
> virsh resume dom
> virsh define dom.xml

Everything looks pretty easy except the polling loop is interesting. How do i stop the bashscript until the blockjob command shows 100%?

Thanks and best regards.
 
Old 06-02-2013, 08:08 AM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Don't poll:
Quote:
virsh(1)

blockcopy domain path dest [bandwidth] [--shallow] [--reuse-external] [--raw] [--wait [--verbose] [{--pivot | --finish}] [--timeout seconds] [--async]]
...

By default, the copy job runs in the background... However, if --wait is specified, then this command will block until the mirroring phase begins, or cancel the operation if the optional timeout in seconds elapses or SIGINT is sent (usually with "Ctrl-C"). ...
 
Old 06-03-2013, 06:14 AM   #3
himpierre
LQ Newbie
 
Registered: Jun 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hello.

Thanks for your answer. Well, and yes the --wait option solves this issue too. But and only but when i would like to poll in a script, how would i do that?

thanks again.

t.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
My latest bash hack: a function for periodically running a command nicely. ewtoombs Linux - General 8 09-11-2012 02:19 PM
[SOLVED] Samsung F4 HD204UI/DOM SMART report shows an issue with software RAID1 chrocket Slackware 0 01-03-2011 03:16 AM
bash completion platypuus Programming 8 05-18-2010 11:17 PM
xterm and bash completion athanatos Slackware 12 07-22-2006 12:47 PM
Health Check / Server Completion Check Software? tells Linux - Enterprise 0 04-20-2006 11:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration