<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=Virsh_Backup_Script_Block_Commit_Mail</id>
	<title>Virsh Backup Script Block Commit Mail - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=Virsh_Backup_Script_Block_Commit_Mail"/>
	<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Virsh_Backup_Script_Block_Commit_Mail&amp;action=history"/>
	<updated>2026-06-29T11:06:28Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Xinux Wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=Virsh_Backup_Script_Block_Commit_Mail&amp;diff=17994&amp;oldid=prev</id>
		<title>Thomas.will am 4. Dezember 2018 um 10:28 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Virsh_Backup_Script_Block_Commit_Mail&amp;diff=17994&amp;oldid=prev"/>
		<updated>2018-12-04T10:28:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 4. Dezember 2018, 10:28 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;source lang=bash&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;VM=$1&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;VM=$1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l43&quot; &gt;Zeile 43:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 43:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;echo &amp;quot;end backup $VM $ENDDATE&amp;quot; &amp;gt;&amp;gt; $LOG&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;echo &amp;quot;end backup $VM $ENDDATE&amp;quot; &amp;gt;&amp;gt; $LOG&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;cat $LOG | mail -s &amp;quot;$SUBJECT&amp;quot; $MAILTO&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;cat $LOG | mail -s &amp;quot;$SUBJECT&amp;quot; $MAILTO&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;source&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-12911:rev-17994 --&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=Virsh_Backup_Script_Block_Commit_Mail&amp;diff=12911&amp;oldid=prev</id>
		<title>Thomas: Die Seite wurde neu angelegt: „&lt;source lang=bash&gt; #!/bin/bash VM=$1 STATE=ss-$(date &quot;+%s&quot;) BACKUP=&quot;/mnt/data/backup/mabel/$VM&quot; DATE=$(date &quot;+%Y-%m-%d-%H-%M&quot;) LOG=/tmp/$VM-$DATE.log SUBJECT=&quot;…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Virsh_Backup_Script_Block_Commit_Mail&amp;diff=12911&amp;oldid=prev"/>
		<updated>2017-04-02T15:57:31Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „&amp;lt;source lang=bash&amp;gt; #!/bin/bash VM=$1 STATE=ss-$(date &amp;quot;+%s&amp;quot;) BACKUP=&amp;quot;/mnt/data/backup/mabel/$VM&amp;quot; DATE=$(date &amp;quot;+%Y-%m-%d-%H-%M&amp;quot;) LOG=/tmp/$VM-$DATE.log SUBJECT=&amp;quot;…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
VM=$1&lt;br /&gt;
STATE=ss-$(date &amp;quot;+%s&amp;quot;)&lt;br /&gt;
BACKUP=&amp;quot;/mnt/data/backup/mabel/$VM&amp;quot;&lt;br /&gt;
DATE=$(date &amp;quot;+%Y-%m-%d-%H-%M&amp;quot;)&lt;br /&gt;
LOG=/tmp/$VM-$DATE.log&lt;br /&gt;
SUBJECT=&amp;quot;OK: $VM Backup&amp;quot;&lt;br /&gt;
MAILTO=&amp;quot;thomas@xxxxx.lan&amp;quot;&lt;br /&gt;
test -d $BACKUP || mkdir -p $BACKUP&lt;br /&gt;
echo &amp;quot;start backup $VM $DATE&amp;quot; &amp;gt; $LOG&lt;br /&gt;
cp -v /etc/libvirt/qemu/$VM.xml $BACKUP/$DATE-$VM.xml &amp;gt;&amp;gt; $LOG&lt;br /&gt;
virsh domblklist $VM | grep &amp;quot;^[sv]d[abcd]&amp;quot; | tr -s &amp;quot; &amp;quot; | while read LINE&lt;br /&gt;
do&lt;br /&gt;
DEV=$(echo $LINE | cut -f 1 -d &amp;quot; &amp;quot;)&lt;br /&gt;
IMG=$(echo $LINE | cut -f 2 -d &amp;quot; &amp;quot;)&lt;br /&gt;
echo virsh snapshot-create-as --domain $VM $STATE --diskspec $DEV,file=$IMG.$STATE --disk-only --atomic  &amp;gt;&amp;gt; $LOG&lt;br /&gt;
if virsh snapshot-create-as --domain $VM $STATE --diskspec $DEV,file=$IMG.$STATE  --disk-only --atomic  &amp;gt;&amp;gt; $LOG&lt;br /&gt;
 then&lt;br /&gt;
   echo rsync $IMG  $BACKUP/$DATE-$IMG  &amp;gt;&amp;gt; $LOG&lt;br /&gt;
   if rsync --progress $IMG $BACKUP/$DATE-$(basename $IMG)  &amp;gt;&amp;gt; $LOG&lt;br /&gt;
     then&lt;br /&gt;
       echo virsh blockcommit $VM $DEV --active --verbose --pivot    &amp;gt;&amp;gt; $LOG&lt;br /&gt;
       if virsh blockcommit $VM $DEV --active --verbose --pivot    &amp;gt;&amp;gt; $LOG&lt;br /&gt;
         then&lt;br /&gt;
          rm -v $IMG.$STATE &amp;gt;&amp;gt; $LOG&lt;br /&gt;
          echo virsh snapshot-delete $VM --metadata $STATE &amp;gt;&amp;gt; $LOG&lt;br /&gt;
          virsh snapshot-delete $VM --metadata $STATE&lt;br /&gt;
         else&lt;br /&gt;
           echo &amp;quot;virsh blockcommit $VM $DEV failed&amp;quot;    &amp;gt;&amp;gt; $LOG&lt;br /&gt;
           SUBJECT=&amp;quot;ERROR: $VM blockcommit failed&amp;quot;&lt;br /&gt;
         fi&lt;br /&gt;
       else&lt;br /&gt;
      echo rsync failed  &amp;gt;&amp;gt; $LOG&lt;br /&gt;
      SUBJECT=&amp;quot;ERROR: $VM rsync failed&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
   else&lt;br /&gt;
 echo virsh snapshot-create-as failed &amp;gt;&amp;gt; $LOG&lt;br /&gt;
    SUBJECT=&amp;quot;ERROR: $VM snapshot create failed&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
done&lt;br /&gt;
ENDDATE=$(date &amp;quot;+%Y-%m-%d-%H-%M&amp;quot;)&lt;br /&gt;
echo &amp;quot;end backup $VM $ENDDATE&amp;quot; &amp;gt;&amp;gt; $LOG&lt;br /&gt;
cat $LOG | mail -s &amp;quot;$SUBJECT&amp;quot; $MAILTO&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Thomas</name></author>
	</entry>
</feed>