Hi,
On 13/05/2015 09:35, Kai Storbeck wrote:
> Hello fellow Ceph admins,
>
> I have a need to run some periodic scripts against my Ceph cluster.
> For example creating new snapshots or cleaning up old ones. I'd
> preferably want to configure this periodic artifact on all my
> monitors, but only execute it on the leader.
>
> I've come up with the following oneliner:
>
> ceph --admin-daemon /var/run/ceph/ceph-mon.*.asok mon_status | perl
> -MJSON -0e 'exit((from_json(<>))->{state} != "leader")'What about: eval state=$(ceph --admin-daemon /var/run/ceph/ceph-mon.*.asok mon_status | jq .state) if test $state = leader ; then ... fi Cheers > > > Has someone written up a quicker shortcut, preferably usable in bash? > Or did someone solve this entirely different? > > > > Thanks in advance! > > Regards, > Kai Storbeck > > > > _______________________________________________ > ceph-users mailing list > [email protected] > http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com > -- Loïc Dachary, Artisan Logiciel Libre
signature.asc
Description: OpenPGP digital signature
_______________________________________________ ceph-users mailing list [email protected] http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
