Hi Mandar,

You can use the stdin option to specify the name of an input file for the 
process, but this input file must contain all the commands you want the 
process to run BEFORE you start the process.  Using a stdin file to pass 
data to your process does not let you do this interactively.  If you have 
all the commands in your stdin file before the process is started, then 
your process can read the commands from the stdin file.  If your process 
is reading the same line from the stdin file repeatedly and writing it to 
a log file, then that is an error in your process's code.  Since you 
didn't post your code, I can't comment on what you're doing wrong.  If you 
post your code, then perhaps I could tell you what you're doing wrong -- 
but note that this wouldn't be a STAF-specific question.  It's simply a 
question of how to read data from a stdin file.

If you want to send commands to the process interactively (i.e. as if you 
were typing commands to an interactive CLI), then you should look at using 
the STAF QUEUE service instead of providing the commands via a stdin file. 
 The QUEUE service (as documented in the STAF User's Guide) provides a 
QUEUE request that lets you send messages to a STAF handle's queue and 
provides a GET request that lets you get messages off a STAF handle's 
queue.  So, you could use a <stafcmd> to submit a QUEUE request to the 
QUEUE service, specifying the process's handle number (or handle name) and 
for the MESSAGE option, specify a command to send to the process.  Then, 
your process can register with STAF (e.g. create a STAF handle) and then 
receive messages on its queue by submitting a GET request to the QUEUE 
service.

Note that you can search the STAF forums and/or mailing list and find 
examples of how to do this using the STAF QUEUE service.

For example, see the posting on the STAF Help Forum at 
http://sourceforge.net/forum/message.php?msg_id=5064397 titled "Queue/Get 
messages from STAX" that provides an example of using a starting a process 
(a Java program) within a STAX job and from its <process-action> 
sub-element, use a <stafcmd> command to send messages to the process's 
queue.

Other postings that might interest you include:
- http://sourceforge.net/forum/message.php?msg_id=4552372
- http://sourceforge.net/forum/message.php?msg_id=5790425

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




Mandar <m_gokhal...@yahoo.com> 
04/03/2009 11:49 AM
Please respond to
m_gokhal...@yahoo.com


To
staf-users@lists.sourceforge.net
cc

Subject
[staf-users] Question regarding STAF/STAX







Hello,

My name is Mandar. I am not sure if this is the best way to ask a 
question/to reach you. It would be really great if I could get some 
feedback with the problem that I am trying to solve.

I am running a process using the <process> element and storing the 
"stdout" and "stderr" in a log file. Once the process has started, I need 
to send commands to the process using <stafcmd> element. I read about 
"stdin" option (in a process) where we can specify a input file to pass 
commands to the process. The problem with that is: Let's say that the file 
contains only 1 command (print hello), the process takes input from the 
file but does it "repeatedly" and fills the log file (thousands of lines) 
with the word hello!

I am really stuck and would appreciate any kind of help. Please let me 
know if you need any additional information.

Thanks,
Mandar
------------------------------------------------------------------------------
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to