You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@whirr.apache.org by Karel Vervaeke <ka...@outerthought.org> on 2011/08/23 17:50:56 UTC
Run commands via whirr
I got bored with writing little scripts when using whirr run-script so
hacked this up. Maybe it's useful to someone.
Usage examples:
whirrcmd --cluster=recipes/mycluster.properties "sudo /usr/bin/jps status"
whirrcmd --cluster=recipes/mycluster.properties --roles="hbase-master"
"sudo /usr/bin/jps status"
Perhaps it be better to add it to whirr (e.g. whirr run-script
--command="" or whirr run-cmd ...),
but I don't know if it's useful enough.
Here's the ugly bit:
whirrcmd() {
local whirr_args
tmpfile=$(mktemp --suffix .sh)
whirr_args=(${@:1:$#-1})
cmd_arg=${@:$#}
cat > $tmpfile <<EOF
#!/bin/bash
$cmd_arg
EOF
whirr run-script ${whirr_args[@]} --script=$tmpfile
rm $tmpfile
}
--
Karel Vervaeke
http://outerthought.org/
Open Source Content Applications
Makers of Kauri, Daisy CMS and Lily
Re: Run commands via whirr
Posted by Tom White <to...@cloudera.com>.
Looks great - I've often wanted something like this. I think adding
"whirr run-cmd" would be the way to add this since then it's
integrated with the whirr command.
Thanks,
Tom
On Wed, Aug 24, 2011 at 2:06 AM, Karel Vervaeke <ka...@outerthought.org> wrote:
> I'd be happy to do the jira dance.
>
> On Tue, Aug 23, 2011 at 6:35 PM, Andrei Savu <sa...@gmail.com> wrote:
>> Looks good! How about adding this as a script in bin/ e.g. bin/whirr-cmd?
>>
>> -- Andrei
>>
>> On Tue, Aug 23, 2011 at 8:50 AM, Karel Vervaeke <ka...@outerthought.org> wrote:
>>> I got bored with writing little scripts when using whirr run-script so
>>> hacked this up. Maybe it's useful to someone.
>>>
>>> Usage examples:
>>> whirrcmd --cluster=recipes/mycluster.properties "sudo /usr/bin/jps status"
>>> whirrcmd --cluster=recipes/mycluster.properties --roles="hbase-master"
>>> "sudo /usr/bin/jps status"
>>>
>>> Perhaps it be better to add it to whirr (e.g. whirr run-script
>>> --command="" or whirr run-cmd ...),
>>> but I don't know if it's useful enough.
>>>
>>> Here's the ugly bit:
>>>
>>> whirrcmd() {
>>> local whirr_args
>>> tmpfile=$(mktemp --suffix .sh)
>>>
>>> whirr_args=(${@:1:$#-1})
>>> cmd_arg=${@:$#}
>>>
>>> cat > $tmpfile <<EOF
>>> #!/bin/bash
>>>
>>> $cmd_arg
>>> EOF
>>>
>>> whirr run-script ${whirr_args[@]} --script=$tmpfile
>>> rm $tmpfile
>>> }
>>>
>>>
>>>
>>> --
>>> Karel Vervaeke
>>> http://outerthought.org/
>>> Open Source Content Applications
>>> Makers of Kauri, Daisy CMS and Lily
>>>
>>
>
>
>
> --
> Karel Vervaeke
> http://outerthought.org/
> Open Source Content Applications
> Makers of Kauri, Daisy CMS and Lily
>
Re: Run commands via whirr
Posted by Karel Vervaeke <ka...@outerthought.org>.
I'd be happy to do the jira dance.
On Tue, Aug 23, 2011 at 6:35 PM, Andrei Savu <sa...@gmail.com> wrote:
> Looks good! How about adding this as a script in bin/ e.g. bin/whirr-cmd?
>
> -- Andrei
>
> On Tue, Aug 23, 2011 at 8:50 AM, Karel Vervaeke <ka...@outerthought.org> wrote:
>> I got bored with writing little scripts when using whirr run-script so
>> hacked this up. Maybe it's useful to someone.
>>
>> Usage examples:
>> whirrcmd --cluster=recipes/mycluster.properties "sudo /usr/bin/jps status"
>> whirrcmd --cluster=recipes/mycluster.properties --roles="hbase-master"
>> "sudo /usr/bin/jps status"
>>
>> Perhaps it be better to add it to whirr (e.g. whirr run-script
>> --command="" or whirr run-cmd ...),
>> but I don't know if it's useful enough.
>>
>> Here's the ugly bit:
>>
>> whirrcmd() {
>> local whirr_args
>> tmpfile=$(mktemp --suffix .sh)
>>
>> whirr_args=(${@:1:$#-1})
>> cmd_arg=${@:$#}
>>
>> cat > $tmpfile <<EOF
>> #!/bin/bash
>>
>> $cmd_arg
>> EOF
>>
>> whirr run-script ${whirr_args[@]} --script=$tmpfile
>> rm $tmpfile
>> }
>>
>>
>>
>> --
>> Karel Vervaeke
>> http://outerthought.org/
>> Open Source Content Applications
>> Makers of Kauri, Daisy CMS and Lily
>>
>
--
Karel Vervaeke
http://outerthought.org/
Open Source Content Applications
Makers of Kauri, Daisy CMS and Lily
Re: Run commands via whirr
Posted by Andrei Savu <sa...@gmail.com>.
Looks good! How about adding this as a script in bin/ e.g. bin/whirr-cmd?
-- Andrei
On Tue, Aug 23, 2011 at 8:50 AM, Karel Vervaeke <ka...@outerthought.org> wrote:
> I got bored with writing little scripts when using whirr run-script so
> hacked this up. Maybe it's useful to someone.
>
> Usage examples:
> whirrcmd --cluster=recipes/mycluster.properties "sudo /usr/bin/jps status"
> whirrcmd --cluster=recipes/mycluster.properties --roles="hbase-master"
> "sudo /usr/bin/jps status"
>
> Perhaps it be better to add it to whirr (e.g. whirr run-script
> --command="" or whirr run-cmd ...),
> but I don't know if it's useful enough.
>
> Here's the ugly bit:
>
> whirrcmd() {
> local whirr_args
> tmpfile=$(mktemp --suffix .sh)
>
> whirr_args=(${@:1:$#-1})
> cmd_arg=${@:$#}
>
> cat > $tmpfile <<EOF
> #!/bin/bash
>
> $cmd_arg
> EOF
>
> whirr run-script ${whirr_args[@]} --script=$tmpfile
> rm $tmpfile
> }
>
>
>
> --
> Karel Vervaeke
> http://outerthought.org/
> Open Source Content Applications
> Makers of Kauri, Daisy CMS and Lily
>