xen backup script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



hello,


 I have a couple of longish commands that I run to backup my network
of xen hosts. I would like to cron this, but am having trouble issuing
the same command the second time to the second xen host:

 [root@LCENT01 ~]# ssh sum2 'for i in `virsh list | grep -v -e Id -e
--- -e "Domain-0"| awk '{print \$1}'`; do echo "shutting down $i";
sleep 2; virsh shutdown $i; sleep 2; echo "domain $i is shutdown";
echo echo; done'
root@sum2's password:
awk: cmd. line:1: {print
awk: cmd. line:1:       ^ unexpected newline or end of string


------

this is the script so far:

#!/bin/bash

for i in `virsh list | grep -v -e Id -e --- -e "Domain-0"| awk '{print
$1}'`; do echo "shutting down $i"; sleep 2; virsh shutdown $i; sleep
2; echo "domain $i is shutdown"; echo; echo; \


for i in *; do echo "copying $i to nas"; sleep 2; rsync -avzp
/mnt/store/xen/$i /mnt/nas/xen; sleep 2; echo "$i has been copied to
nas"; echo; echo; done

ssh sum2 'for i in `virsh list | grep -v -e Id -e --- -e "Domain-0"|
awk '{print \$1}'`; do echo "shutting down $i"; sleep 2; virsh
shutdown $i; sleep 2; echo "domain $i is shutdown"; echo echo; done'


I think this could actually pretty useful for folks. feel free to use
and improve I would appreciate the feedback to get this to work so I
don't have to run two separate jobs on separate hosts

thanks!!!




-- 
Here's my RSA Public key:
gpg --keyserver pgp.mit.edu --recv-keys 5A4873A9

Share and enjoy!!
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux