Mailing List Archive

writing a script
Hi,

is there an easy way to determine in a script (bash or python) whether
a CRM Resource (Xen Domain) is running or not ?

Thanks in advance
karl

--
Karl Rößmann Tel. +49-711-689-1657
Max-Planck-Institut FKF Fax. +49-711-689-1632
Postfach 800 665
70506 Stuttgart email K.Roessmann@fkf.mpg.de


_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org
Re: writing a script [ In reply to ]
2015-08-12 15:45 GMT+02:00 Karl Rößmann <K.Roessmann@fkf.mpg.de>:

>
> Hi,
>
> is there an easy way to determine in a script (bash or python) whether
> a CRM Resource (Xen Domain) is running or not ?
>

We query the location of a resource in bash with this:

if [ ! "$(/usr/sbin/crm_resource -Q -r resourcename -W)" = "$(hostname)" ];
then

just have a look at "man crm_resource" i'm pretty sure you'll find
something suitable.
Re: writing a script [ In reply to ]
On 12.08.2015 17:18, Michael Böhm wrote:
> 2015-08-12 15:45 GMT+02:00 Karl Rößmann <K.Roessmann@fkf.mpg.de>:
>
>>
>> Hi,
>>
>> is there an easy way to determine in a script (bash or python) whether
>> a CRM Resource (Xen Domain) is running or not ?
>>
>
> We query the location of a resource in bash with this:
>
> if [ ! "$(/usr/sbin/crm_resource -Q -r resourcename -W)" = "$(hostname)" ];
> then
>
> just have a look at "man crm_resource" i'm pretty sure you'll find
> something suitable.
>

"crm resource status <resourcename>" is also possible. But having some
more script-friendly output would be good.

_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org
Re: writing a script [ In reply to ]
Hi,

I also tried with 'crm_resource'.
I'm not a python export, but I inserted this line:

if os.system("crm_resource -r " + myVM + " -W | grep 'is running'") == 0:

which works !

thanks to the list.


Quoting Michael Böhm <dudleyperkins@gmail.com>:

> 2015-08-12 15:45 GMT+02:00 Karl Rößmann <K.Roessmann@fkf.mpg.de>:
>
>>
>> Hi,
>>
>> is there an easy way to determine in a script (bash or python) whether
>> a CRM Resource (Xen Domain) is running or not ?
>>
>
> We query the location of a resource in bash with this:
>
> if [ ! "$(/usr/sbin/crm_resource -Q -r resourcename -W)" = "$(hostname)" ];
> then
>
> just have a look at "man crm_resource" i'm pretty sure you'll find
> something suitable.



--
Karl Rößmann Tel. +49-711-689-1657
Max-Planck-Institut FKF Fax. +49-711-689-1632
Postfach 800 665
70506 Stuttgart email K.Roessmann@fkf.mpg.de


_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org