s.start_scp &&

56 views
Skip to first unread message

Ron Sweeney

unread,
Jan 26, 2012, 9:06:27 PM1/26/12
to ruby-...@googlegroups.com


Can anybody give me some direction on what I a need to be looking for or investigate if I wanted to run/start a ruby-dicom scp on rails boot, monitor to keep it up, and tear it down when the app goes down ?
My google foo keeps landing me on threaded solutions for long running background tasks like delayed_job, etc...

I looked at "custom daemon" but not sure if thats the most elegant approach...

Thoughts ?


--
Ron Sweeney
Medical Imaging by Example
<http://www.ideafoundry.info/medical-imaging>
Health Neutral

Christoffer Lervåg

unread,
Jan 27, 2012, 3:59:36 AM1/27/12
to ruby-...@googlegroups.com
Hi Ron

I can tell you how I've done it when playing with my own dicom
server/rails combo, but Im guessing you may be looking for something
more sofisticated.

Anyway, I've just started the dicom server in its own thread, which
means that the dicom server starts when the rails application starts,
and it also shuts down when the rails application is brought down.

These couple of lines are placed at the end of the config/environment.rb file:

# Start the DICOM Server in a separate thread:
s = DICOM::DServer.new(11112, :ae => "RAILS-DICOM", :file_handler =>
DICOM::RailsFileHandler)
t = Thread.new { s.start_scp("./public/dicom/") }


Regards,
Chris

Reply all
Reply to author
Forward
0 new messages