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 >