error handling with storescu

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
niirdan
Posts: 21
Joined: Wed, 2023-02-22, 13:13

error handling with storescu

#1 Post by niirdan »

Good morning ,
Currently i am using storescu-tls to transfer dicom material to a given remote pac's (owned by me) .
after the execution completed , I remove the files from the local directory using Linux rm command .
the problem is that with this strategy i cant handle error , for e.g. connection failure . in this case in the manner of Linux machine storescu runed successfully even though files weren't arrived .
there is any way to get any acknowledge when association released \ or when error occured?

Code: Select all

sudo storescu --debug --aetitle censored --call cencored --required --propose-jpeg8 ip-censored 444 --scan-directories "dir-path-censored" +r --enable-tls -censored-key -censored-cert --add-cert-file -censored-ca-dir 

# Delete all files from the directory
sudo rm -rf -censored-removed-dir

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: error handling with storescu

#2 Post by Marco Eichelberg »

storescu will return a nonzero return code if anything went wrong. You can use that to determine that the files should not be deleted yet, but the return code as such will not tell you what exactly went wrong or which image was not fully transmitted.
Furthermore, running storescu with "sudo" is a very bad idea.

niirdan
Posts: 21
Joined: Wed, 2023-02-22, 13:13

Re: error handling with storescu

#3 Post by niirdan »

Hey Marco, good morning
thank you very much for your response, I completely missed it out .
when your saying running storescu with sudo is a bad idea , what is the reason for that ?
what is your recommendation solution running it ?
In addition , where can I handle the returned nonzero code, there are some documentation regarding this ?
best regards, Dan

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: error handling with storescu

#4 Post by Marco Eichelberg »

when your saying running storescu with sudo is a bad idea , what is the reason for that ?
A tool should, in general, always run with the least required privileges. storescu does not need root access rights. The only possible reason might be that it runs as a user that cannot access the DICOM files to be sent. In that case, the access rights should be fixed (e.g. by assigning them to a group shared by the creator and the user running storescu). If anything goes wrong, a process running as root would be able to erase your entire system.
where can I handle the returned nonzero code
Read the documentation on shell scripts 8)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest