On Thu, Nov 20, 2008 at 4:18 PM, Jorge Dias <[EMAIL PROTECTED]> wrote:
> Hi, I've been having some issues integrating bdrb on a cruisecontrolrb
> server
> It's related to the way we stop the bdrb server. The thing is, right now
> when we stop the process we are killing the parent of the group of the
> process. This is ok if you're running script/backgroundrb stop directly from
> the console, but if I'm running this from another process, let's say a rake
> task, the rake task gets killed because it gets the SIGTERM signal.
>
> In the class StarStop we have:
>
> def kill_process arg_pid_file
> pid = nil
> pid = File.open(arg_pid_file, "r") { |pid_handle|
> pid_handle.gets.strip.chomp.to_i }
> pgid = Process.getpgid(pid)
> puts "Stopping BackgrounDRb with pid #{pid}...."
> Process.kill('-TERM', pgid)
> File.delete(arg_pid_file) if File.exists?(arg_pid_file)
> puts "Success!"
> end
>
> What I did was, that instead of killing pgid, I'm doing a system call and
> killing the pid, like this
>
> def kill_process arg_pid_file
> pid = nil
> pid = File.open(arg_pid_file, "r") { |pid_handle|
> pid_handle.gets.strip.chomp.to_i }
> puts "Stopping BackgrounDRb with pid #{pid}...."
> system("kill -s TERM #{pid}") #This is what's different
> File.delete(arg_pid_file) if File.exists?(arg_pid_file)
> puts "Success!"
> end
>
> I did the system call because Process, says that there's no process with the
> pid we extract from the file.
>
> It's working good, but I don't know if there are some hidden side effects?
> any ideas?
>
> here's a rake task so you can try what I'm saying http://pastie.org/318949
Hmm, I will play with this and let you know. Doesn't look like much of
problem, except that system call is opaque.
_______________________________________________
Backgroundrb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel