0

I'm trying to start a server process (storescp, from dicom toolkit) and a file system watcher (via inotifywait) from a shell script. Here's what I have so far.

#!/bin/bash

INFOLDER=/home/dicom/storescp_in/
OUTFOLDER=/home/dicom/dicom_jpeg

#watch the input directory
inotifywait -m -e close_write "$INFOLDER" | while read dicomfile
do
mv "$INFOLDER""dicomfile"  "$OUTFOLDER""$dicomfile"

done    

# start the storescp server
storescp -v -od $INFOLDER 104

But inotifywait appears to be a blocking call (sorry, i'm coming at this from a javascript event driven kind of experience; I don't have much experience with Bash scripts).. is it possible to start my server and inotifywait in the same script? how?

Aerik
  • 2,307
  • 1
  • 27
  • 39

1 Answers1

1

I solved it by using the & operator, like in question How do you run multiple programs in parallel from a bash script?

Seems to be just the thing!

Community
  • 1
  • 1
Aerik
  • 2,307
  • 1
  • 27
  • 39