On Thu, 15 Sep 2005, Jamis Buck wrote: <snip trouble restarting fcgi apps> how about a completely different approach to restarting - restart without exiting using the 'exec' system call. this won't return an exit status to the fcgi pm and, i think, therefore won't cause trouble: [ahoward@localhost html]$ cat reloadable.fcgi #! /usr/local/bin/ruby require 'fcgi' loaded, pid = Time::now, Process::pid FCGI.each_cgi do |cgi| env = cgi.env_table.sort.map{|kv| kv.join " = "}.join " <br>\n" content = <<-html command_line : #{ $command_line } <br> loaded : #{ loaded } <br> pid : #{ pid } <br> <hr><hr> #{ env } html cgi.out{ content } end BEGIN { require 'rbconfig' $config = ::Config::CONFIG $ruby = File::join($config['bindir'], $config['ruby_install_name']) + $config['EXEEXT'] $this = $0 $command_line = [$ruby, $this, ARGV].flatten.join(' ') trap('USR2'){ exec $command_line } } [ahoward@localhost html]$ lynx -dump http://localhost/reloadable.fcgi |egrep 'loaded|pid' loaded : Thu Sep 15 12:46:36 MDT 2005 pid : 16018 [ahoward@localhost html]$ lynx -dump http://localhost/reloadable.fcgi |egrep 'loaded|pid' loaded : Thu Sep 15 12:46:36 MDT 2005 pid : 16018 so we are running in fastcgi mode, the process has been loaded only once. force a restart: [ahoward@localhost html]$ sudo kill -USR2 16018 [ahoward@localhost html]$ lynx -dump http://localhost/reloadable.fcgi |egrep 'loaded|pid' loaded : Thu Sep 15 12:47:33 MDT 2005 pid : 16018 and it works! [ahoward@localhost html]$ lynx -dump http://localhost/reloadable.fcgi |egrep 'loaded|pid' loaded : Thu Sep 15 12:47:33 MDT 2005 pid : 16018 and sticks. [ahoward@localhost html]$ sudo kill -USR2 16018 [ahoward@localhost html]$ lynx -dump http://localhost/reloadable.fcgi |egrep 'loaded|pid' loaded : Thu Sep 15 12:47:43 MDT 2005 pid : 16018 [ahoward@localhost html]$ lynx -dump http://localhost/reloadable.fcgi |egrep 'loaded|pid' loaded : Thu Sep 15 12:47:43 MDT 2005 pid : 16018 and works again. checking the log [ahoward@localhost html]$ sudo tail -3 /var/log/httpd/error_log [Thu Sep 15 12:47:25 2005] [warn] (32)Broken pipe: FastCGI: write() to PM failed (ignore if a restart or shutdown is pending) [Thu Sep 15 12:47:40 2005] [warn] (32)Broken pipe: FastCGI: write() to PM failed (ignore if a restart or shutdown is pending) [Thu Sep 15 12:47:49 2005] [warn] (32)Broken pipe: FastCGI: write() to PM failed (ignore if a restart or shutdown is pending) so i guess i'll ignore it. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================