<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="lt">
	<id>https://wiki.eofnet.lt/w//index.php?action=history&amp;feed=atom&amp;title=Backup-virsh</id>
	<title>Backup-virsh - Versijų istorija</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.eofnet.lt/w//index.php?action=history&amp;feed=atom&amp;title=Backup-virsh"/>
	<link rel="alternate" type="text/html" href="https://wiki.eofnet.lt/w//index.php?title=Backup-virsh&amp;action=history"/>
	<updated>2026-04-23T10:08:55Z</updated>
	<subtitle>Šio puslapio versijų istorija projekte</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.eofnet.lt/w//index.php?title=Backup-virsh&amp;diff=9046&amp;oldid=prev</id>
		<title>\dev\null 12:36, 26 vasario 2020</title>
		<link rel="alternate" type="text/html" href="https://wiki.eofnet.lt/w//index.php?title=Backup-virsh&amp;diff=9046&amp;oldid=prev"/>
		<updated>2020-02-26T12:36:31Z</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;lt&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Ankstesnė versija&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;12:36, 26 vasario 2020 versija&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;1 eilutė:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1 eilutė:&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;Scriptas skirtas daryti virsh xml backupus, uploadinti ir priskirti kaip pre&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;-&lt;/del&gt;script.&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;Scriptas skirtas daryti virsh xml backupus, uploadinti ir priskirti kaip pre &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;job &lt;/ins&gt;script.&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;/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;/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;[[Vaizdas:Screenshot 2020-02-26 at 14.34.35.png|400px]]&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;[[Vaizdas:Screenshot 2020-02-26 at 14.34.35.png|400px]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>\dev\null</name></author>
	</entry>
	<entry>
		<id>https://wiki.eofnet.lt/w//index.php?title=Backup-virsh&amp;diff=9045&amp;oldid=prev</id>
		<title>\dev\null 12:35, 26 vasario 2020</title>
		<link rel="alternate" type="text/html" href="https://wiki.eofnet.lt/w//index.php?title=Backup-virsh&amp;diff=9045&amp;oldid=prev"/>
		<updated>2020-02-26T12:35:53Z</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;lt&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Ankstesnė versija&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;12:35, 26 vasario 2020 versija&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;1 eilutė:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1 eilutė:&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;Scriptas skirtas daryti virsh xml backupus, uploadinti ir priskirti kaip pre-script.&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;Scriptas skirtas daryti virsh xml backupus, uploadinti ir priskirti kaip pre-script.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Vaizdas:Screenshot 2020-02-26 at 14.34.35.png|400px]]&lt;/ins&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;/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;/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;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&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;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>\dev\null</name></author>
	</entry>
	<entry>
		<id>https://wiki.eofnet.lt/w//index.php?title=Backup-virsh&amp;diff=9043&amp;oldid=prev</id>
		<title>\dev\null: Naujas puslapis: Scriptas skirtas daryti virsh xml backupus, uploadinti ir priskirti kaip pre-script.  &lt;syntaxhighlight lang=&quot;bash&quot;&gt; #!/bin/bash  # # Name: backup-virsh.sh # Author: justinas@eofn...</title>
		<link rel="alternate" type="text/html" href="https://wiki.eofnet.lt/w//index.php?title=Backup-virsh&amp;diff=9043&amp;oldid=prev"/>
		<updated>2020-02-26T12:33:26Z</updated>

		<summary type="html">&lt;p&gt;Naujas puslapis: Scriptas skirtas daryti virsh xml backupus, uploadinti ir priskirti kaip pre-script.  &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; #!/bin/bash  # # Name: backup-virsh.sh # Author: justinas@eofn...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Naujas puslapis&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Scriptas skirtas daryti virsh xml backupus, uploadinti ir priskirti kaip pre-script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# Name: backup-virsh.sh&lt;br /&gt;
# Author: justinas@eofnet.lt&lt;br /&gt;
# Description: Backups virsh xml machines on target host, It will copy to Elkarbackup only the modified xml files.&lt;br /&gt;
# Use: JOB level -&amp;gt; Pre-Script&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
URL=`echo $ELKARBACKUP_URL | cut -d &amp;quot;:&amp;quot; -f1`    # user@serverip&lt;br /&gt;
USER=&amp;quot;${URL%@*}&amp;quot;                                # user&lt;br /&gt;
HOST=&amp;quot;${URL#*@}&amp;quot;                                # host&lt;br /&gt;
DIR=`echo $ELKARBACKUP_URL | cut -d &amp;quot;:&amp;quot; -f2`    # path&lt;br /&gt;
TMP=/tmp/ebvirshbackup&lt;br /&gt;
&lt;br /&gt;
SSHPARAMS=&amp;quot;-i /var/lib/elkarbackup/.ssh/id_rsa -o StrictHostKeyChecking=no $ELKARBACKUP_SSH_ARGS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TEST=`ssh $SSHPARAMS $USER@$HOST &amp;quot;test -f /usr/bin/virsh &amp;amp;&amp;amp; echo $?&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
if [ ! ${TEST} ]; then&lt;br /&gt;
    echo &amp;quot;[ERROR] virsh binary doesn't exist /usr/bin/virsh on target machine&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$ELKARBACKUP_LEVEL&amp;quot; != &amp;quot;JOB&amp;quot; ]&lt;br /&gt;
then&lt;br /&gt;
    echo &amp;quot;Only allowed at job level&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$ELKARBACKUP_EVENT&amp;quot; == &amp;quot;PRE&amp;quot; ]&lt;br /&gt;
then&lt;br /&gt;
    # If backup directory doesn't exist, create it&lt;br /&gt;
    TEST=`ssh $SSHPARAMS $USER@$HOST &amp;quot;test -d $DIR &amp;amp;&amp;amp; echo $?&amp;quot;`&lt;br /&gt;
    if [ ! ${TEST} ]; then&lt;br /&gt;
        echo &amp;quot;[INFO] Backup directory $DIR doesn't exist. Creating...&amp;quot;&lt;br /&gt;
        ssh $SSHPARAMS $USER@$HOST &amp;quot;mkdir -p $DIR&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    # If tmp directory doesn't exist, create it&lt;br /&gt;
    TEST=`ssh $SSHPARAMS $USER@$HOST &amp;quot;test -d $TMP &amp;amp;&amp;amp; echo $?&amp;quot;`&lt;br /&gt;
    if [ ! ${TEST} ]; then&lt;br /&gt;
        echo &amp;quot;[INFO] TMP directory $TMP doesn't exist. Creating...&amp;quot;&lt;br /&gt;
        ssh $SSHPARAMS $USER@$HOST &amp;quot;mkdir -p $TMP&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    # Get all virsh instances&lt;br /&gt;
    instances=`ssh $SSHPARAMS $USER@$HOST &amp;quot;/usr/bin/virsh list --all --name&amp;quot;`&lt;br /&gt;
    RESULT=$?&lt;br /&gt;
       if [ $RESULT -ne 0 ]; then&lt;br /&gt;
           echo &amp;quot;ERROR: $instances&amp;quot;&lt;br /&gt;
           exit 1&lt;br /&gt;
       else&lt;br /&gt;
          for dom in $instances; do&lt;br /&gt;
          # Doing dump&lt;br /&gt;
          ssh $SSHPARAMS $USER@$HOST &amp;quot;/usr/bin/virsh dumpxml $dom &amp;gt; \&amp;quot;$TMP/$dom.xml\&amp;quot;&amp;quot;&lt;br /&gt;
          # If we already have an old version...&lt;br /&gt;
          TEST=`ssh $SSHPARAMS $USER@$HOST &amp;quot;test -f $DIR/$dom.xml &amp;amp;&amp;amp; echo $?&amp;quot;`&lt;br /&gt;
            if [ ${TEST} ]; then&lt;br /&gt;
                # Diff&lt;br /&gt;
                #echo &amp;quot;making a diff&amp;quot;&lt;br /&gt;
                TEST=`ssh $SSHPARAMS $USER@$HOST &amp;quot;diff -q &amp;lt;(cat $TMP/$dom.xml|head -n -1) &amp;lt;(cat $DIR/$dom.xml|head -n -1) &amp;gt; /dev/null &amp;amp;&amp;amp; echo $?&amp;quot;`&lt;br /&gt;
                #echo &amp;quot;diff result: [$TEST]&amp;quot;&lt;br /&gt;
                # If Diff = false, copy tmp dump file&lt;br /&gt;
                if [ ! ${TEST} ]; then&lt;br /&gt;
                    ssh $SSHPARAMS $USER@$HOST &amp;quot;cp $TMP/$dom.xml $DIR/$dom.xml&amp;quot;&lt;br /&gt;
                    echo &amp;quot;[$dom.xml] Changes detected. New dump saved.&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                    echo &amp;quot;[$dom.xml] No changes detected. Nothing to save.&amp;quot;&lt;br /&gt;
                fi&lt;br /&gt;
            else&lt;br /&gt;
                echo &amp;quot;[$dom.xml] First dump created!&amp;quot;&lt;br /&gt;
                ssh $SSHPARAMS $USER@$HOST &amp;quot;cp $TMP/$dom.xml $DIR/$dom.xml&amp;quot;&lt;br /&gt;
            fi&lt;br /&gt;
&lt;br /&gt;
          done&lt;br /&gt;
       fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;br /&gt;
[[Category:Elkarbackup]]&lt;/div&gt;</summary>
		<author><name>\dev\null</name></author>
	</entry>
</feed>