[FASTCGI] apache restart

Bryan White bryan at arcamax.com
Thu Aug 7 07:32:22 EDT 2008

David Birnbaum wrote:
> Steffen,
> You're trying to overwrite, and the OS has it locked.  Maybe you can 
> rename it:
>   mv /usr/lib/cgi-bin/test2.fcgi /usr/lib/cgi-bin/test2.fcgi.bak
>   cp test2.fcgi /usr/lib/cgi-bin/test2.fcgi
>   [ kill test2.fcgi process or whatever ]
>   rm /usr/lib/cgi-bin/test2.fcgi.bak
> David.

A strategy I have used that has worked well is to have the application 
keep track of the timestamp on its executable file.  When the time stamp 
changes, exit.

I do the check before handling each request.  It might be better to do 
it after the request, but that might cause problems being sure you are 
running the latest version in a compile and test cycle.

Then to roll out a new version I do:
    mv prog prog.old; mv prog.new prog

The first method has the advantage of being able to undo the change if 
it goes horribly wrong.

This works as well:
    rm prog; mv prog.new prog

This works because Linux maintains a link to the file as long as it is 
executing.  The disk space is not recovered until exit.

This also works beautifully in a gcc compile and test cycle because gcc 
removes the old one before creating the new one.
Bryan White

More information about the FastCGI-developers mailing list