Page 1 of 1

Writing dssh scripts

Posted: Wed Aug 27, 2014 5:10 am
by zulfi123786
Hi,

I would like to know if dssh supports a batch mode, the intention is to write a scripts which would perform below activities:

1. Add VOC entry for a hashed file
2. Delete VOC entry for hashed file
3. Create and build secondary indexes for hashed files
4. Delete secondary indexes for hashed files
5. Fetch a particular record from hashed file from Unix script.

We can perform 1-4 in interactive mode but would like to have scripts with parameters that can be executed rather than having every developer meddling with VOC file.


Thanks

Posted: Wed Aug 27, 2014 7:56 am
by chulett
Not sure about the 'batch mode' you mentioned but you can certainly execute dssh queries from the command line and bundle those into scripts.

But then it seems you already know that. :wink:

Posted: Wed Aug 27, 2014 8:01 am
by zulfi123786
To bundle the commands in a script and run them, is there any flag of dssh which accepts the script file as input and runs it ?

From inside the dssh script, is it posible to run a query and let the result dumped into a flat file using standard redirection.

Thanks

Posted: Wed Aug 27, 2014 8:08 am
by chulett
See edited reply.

I meant your shell script could 'bundle' as in make multiple calls to dssh, one for each command / function you needed to run. Did not mean to imply there is any kind of 'script' capability within dssh itself, although there very well could be. Never had a need to investigate any such thing so others will need to clarify that for you.

There's always COMO ON and COMO OFF for that 'redirection' but me, I'd stick with using standard stuff from the command line and leave COMO for the interactive client sessions.

Posted: Wed Aug 27, 2014 4:07 pm
by ray.wurlod

Code: Select all

1.  UVwrite hashedfile keyvalue field1 field2 ...  
     (warning: this is a destructive overwrite).
2.  UVdelete hashedfile keyvalue
3.  dssh "CREATE.INDEX hashedfile columnname" && dssh "BUILD.INDEX hashedfile columnname"
4.  dssh "DELETE.INDEX hashedfile columnname"
5.  UVread hashedfile keyvalue
Make sure that your command search path (PATH environment variable) includes $DSHOME/bin for these commands.

Posted: Thu Aug 28, 2014 3:02 am
by zulfi123786
chulett wrote:But then it seems you already know that. :wink:
Wow :) you spotted an appropriate post of mine. Looks like your version of DSXchange supplies appropriate links like those found in social networking sites ;)

Yup, I was wondering if at all there was any flag in dssh that takes a file with queries with the intention to avoid the to and fro calls to dssh. Anyhow I will go ahead with bundling them into shell script.


Thanks

Posted: Thu Aug 28, 2014 3:24 am
by zulfi123786
ray.wurlod wrote:

Code: Select all

5.  UVread hashedfile keyvalue
Thanks for the reply Ray, Is there a way to fetch all records of select query from dssh by getting rid of "Press any key to continue..."


Thanks

Posted: Thu Aug 28, 2014 12:52 pm
by ray.wurlod
Add the NO.PAGE keyword to the query.

Or redirect stdin from /dev/null.

Code: Select all

dssh "SELECT * FROM VOC;" < /dev/null
This provides the responses to "Press any key to continue . . ."