My read of the question is that Manoj is he wants to call a shell script
from within marklogic,  not call marklogic from within a shell script.

My solution to this is to setup a CGI service on a local web server
(same box as the ML server).

This is a similar concept to how the SQL and Java integration works in
MarkLogic.

 

In my case I needed to run some java and script code to produce a PDF
given marklogic data.

I setup a Tomcat installation, and used the xmlsh J2EE module.

 

http://www.xmlsh.org/EmbeddingServlet

 

This exposes xmlsh scripts as URL's.   Then the MarkLogic does an HTTP
Post to invoke the script, pass it data,  the output of the script is a
PDF file.

The same concept could be done with sh/bash/ksh etc but you'd have to
write your own servlet.

The xmlsh servlet invokes xmlsh which is about 80% directly compatible
with sh syntax, but also can call any subprocess as a command so you
could leverage it to call a bash script if you want (or discover that
the bash script runs 'as is' in xmlsh).

 

 

 

 

 

----------------------------------------

David A. Lee

Senior Principal Software Engineer

Epocrates, Inc.

[email protected] <mailto:[email protected]> 

812-482-5224

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Damon
Feldman
Sent: Monday, March 21, 2011 10:11 AM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] How to invoke shell script from
marklogic

 

Manoj,

 

I suggest using wget to send an HTTP request. The URI of the HTTP
request should specify a main module that uses xdmp:get-request-field()
to extract text parameters from the HTTP request.

 

I believe the cqsh utility also allows xquery to be evaluated from a
shell script.

 

Yours,

Damon

 

________________________________

From: [email protected]
[[email protected]] On Behalf Of Manoj
[[email protected]]
Sent: Monday, March 21, 2011 9:47 AM
To: [email protected]
Subject: [MarkLogic Dev General] How to invoke shell script from
marklogic

Hi All,
    I am working on a requirement, where we have created a shell script
to perform certain task on the files. I want to know is there a
provision in Marklogic, using which we can invoke the shell script?

Thanks & Regards
Manoj

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to