Re: virtdown script

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



Ljubomir Ljubojevic wrote:
> Tim Dunphy wrote:
>>
>> I have a small shell script that I wrote that is meant to quickly bring
>> down all of my xen instances in a quick and easy manner. Odd thing is,
>> it does work on the command line. But if I put it into a script this
>> happens:
>>
>>
>> [root@LCENT03:/home/bluethundr/bin] #virtdown
>>
>> it expects another command to happen. which is odd since all of the text
>> delimiters (" and ') are balanced according to vim. I was wondering if I
>> could have an opinion on why this might be happening. Here's the script:
>>
>> #/bin/bash
>>
>> for i in $(virsh list | grep -v -e Id -e --- -e Domain-0 | awk '{print
>> $1}');
>> do
>> /usr/bin/virsh shutdown $i
>> done
>
> Last thing I saw is "#/bin/bash" instead of "#!/bin/bash". Fix and try.
<snip>
or (I'm guessing here, since I don't know what virsh list looks like)
awk '{if ( $0 !~ /Id/ && $0 ~ /Domain-0/ ) { cmd = "/usr/bin/virsh
shutdown " $1; system(cmd);}}' `virsh list`

          mark "awk are us"

_______________________________________________
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