storescp with --exec-on-reception from xinetd

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
jsalk
DCMTK Tester
Posts: 13
Joined: Thu, 2004-11-25, 15:59

storescp with --exec-on-reception from xinetd

#1 Post by jsalk » Mon, 2006-09-11, 16:18

Hi all,

I am currently trying to invoke storescp with --exec-on-reception
option from xinetd.

This is what I have in /etc/xinetd.d/storescp on the server machine:

Code: Select all


service acr-nema
{
   socket_type     = stream
   wait            = no
   user            = root
   server          = /usr/bin/storescp
   server_args     = -id -xcr '/tmp/dcmscript.sh #p #f #a #c' -od /tmp/incoming
   disable         = no
}

The script /tmp/dcmscript.sh just prints out a time stamp and its
command line arguments:

Code: Select all


#!/bin/bash

date >>/tmp/storescp.out
for i in $@; do echo $i; done  >>/tmp/storescp.out
exit 0

As the placeholders #p, #f etc. are replaced by the
storage path, filenames etc. , I would expect these items
listed in /tmp/storescp.out afterwards.

However, when I try to submit some images to this server I am
getting the following error message:

Code: Select all

salk@client:~/temp/dcm> storescu -v server 104 image.dcm
Requesting Association
storescu: Association Request Failed:
0006:0321 Unrecognized PDU type: 24
(And the file /tmp/storescp is not created.)

If I run storescp from command line at the server (i.e. not
from xinetd) everything works fine, i.e. I get the time stamp
and the storage path, filename, etc. in the /tmp/storescp.out
file.

Also if I remove the place holders #p, #f etc. from the xinetd configuration,
i.e. change

Code: Select all

   server_args     = -id -xcr '/tmp/dcmscript.sh #p #f #a #c' -od  ...
to

Code: Select all

   server_args     = -id -xcr '/tmp/dcmscript.sh' -od  ...
everything works as expected, i.e. the DICOM files are transmitted,
the time stamp is added to /tmp/storescp.out (but no command line
arguments, of course).

Does anbody have any idea how to run storescp with--exec-on-reception
from xinetd and have the placeholders #p, #f correctly replaced
at runtime.

Thank you in advance.

Best regards - Juergen

afletdinov
Posts: 3
Joined: Tue, 2008-08-19, 11:29

#2 Post by afletdinov » Wed, 2008-08-20, 05:41

This is bug in xinetd with server_args and quote string.
You need use wrapper sh file:
exec /usr/bin/storescp -id -xcr '/tmp/dcmscript.sh #p #f #a #c' -od /tmp/incoming

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest