Hi Greg

Thanks, but what I'm really after is executing a script (non-interactive)

This is what i've got:

#!/usr/bin/env escript
%% -*- erlang -*-
%%! -name riakinspect -setcookie riak

main([]) ->
 %{ok, Client} = riak:client_connect('[email protected]'),
 % i have the module compiled in /tmp
 code:add_path("/tmp"),
 bucket_inspector:inspect(<<"bucket">>, '[email protected]').


Outputs:

escript: exception error: undefined function riak:client_connect/1
  in function  bucket_inspector:inspect/2
  in call from erl_eval:local_func/5
  in call from escript:interpret/4
  in call from escript:start/1
  in call from init:start_it/1
  in call from init:start_em/1

Looks like it can't find riak in its path. I could pass-in a client, but
have no clue how.

tl;dr  I want to do something like this:
http://contrib.basho.com/usage.html but on a script.

Thanks,
Francisco



2011/10/3 Greg Pascale <[email protected]>

>  Hey Francisco,
>
> If what you're looking to do is connect to Riak in Erlang without having to
> run 'riak attach', try this little bit of magic.
>
> http://www.clipboard.com/clip/LR04fvr5rXWvT__G
>
> The value for "cookie" will be "riak" unless you've changed it.
>
> --
> Greg
> Clipboard
>
> On Monday, October 3, 2011 at 6:20 AM, francisco treacy wrote:
>
> Please?  at least a pointer!
>
> 2011/9/29 francisco treacy <[email protected]>
>
> I'm wanting to use the `bucket_inspector` contrib function (but have zero
> Erlang experience).
>
> Following the "usage" page, I do the following:
>
> $ /opt/riak/erts-5.7.5/bin/erlc -o /tmp /tmp/bucket_inspector.erl$ riak 
> attach([email protected])1> code:add_path("/tmp").([email protected])2> 
> m(bucket_inspector).([email protected])3> bucket_inspector:inspect(<<"bucket">>, 
> '[email protected]').
>
> And it works.
>
> Now, if I want to run that non-interactively, as a script, how should I
> proceed?
>
> I played around with escript but I can't seem to load the Riak path (so the
> script will fail at `code` et al)
>
> Thanks,
>
> Francisco
>
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
>
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to