From: Eric Hodel Date: 2005-08-23T11:52:23+09:00 Subject: Re: server.rb with a Manager and Job Class? On 22 Aug 2005, at 07:06, Christopher Aldridge wrote: > all, I couldnt get this to work so I'm hoping that someone can offer > assistance.. > > I've got ~ 9 XP machines that run server.rb from > \\sambaserver\server.rb (for example) > > When I make changes to \\sambaserver\server.rb, I'd like to tell the > clients to restart server.rb. > > Initally, I figured I could do it as such > ##forgive sytax as I can't see my original code from here.. > > //------------------------server-------------------------// > class server > def handle_job > puts "doing what server should do day to day" > end > > def manage_server > puts "shutting down server" > drb_stop_service ##kills this drb service (or should) exec "ruby server.rb" # use rbconfig.rb to find ruby > end > end > > sleep 10 #### to allow this process to die, and free up the > listening port > DRb.start_service ## for class server > //------------------------/server------------------------// > > What seems to happen, is netstat displays a persistant established > session to the server port until the new server (opened with start) > exists with a drb error stating it cant bind to the listening port, > (due to the fact that the parent server.rb is utilizing it) > > Any way around this? I'd really like to be able to manage these > servers with out manual restarts etc. exec might do it on win32, but I forget. You may need to walk through all your sockets and close them before exec(). ObjectSpace will find them for you. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04