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?