whirr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karel Vervaeke <ka...@outerthought.org>
Subject Run commands via whirr
Date Tue, 23 Aug 2011 15:50:56 GMT
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

Mime
View raw message