Re: [fwd] How to SysAdmin Apache FCGI ?

Tom Neff (tneff@ns1.bloomberg.com)
Wed, 05 Mar 1997 14:33:05 -0500

Message-Id: <3.0.32.19970305142724.00fc0eb0@mothra.bloomberg.com>
Date: Wed, 05 Mar 1997 14:33:05 -0500
To: fastcgi-developers@OpenMarket.com
From: Tom Neff <tneff@ns1.bloomberg.com>
Subject: Re: [fwd] How to SysAdmin Apache FCGI ?

>On Wed, 5 Mar 1997, Stanley Gambarin wrote:
>
>> How does one refresh an AppClass executeable without doing
>> a kill -SIGHUP on httpd?

The best way is to code the app itself to trap a custom signal (e.g. USR1)
and exit gracefully yourself when it's received.  The server will reload
the app afterwards.

For an active app this works:
=============
int do_exit = 0;

void s_usr1() {
        do_exit = 1;
        (void)signal(SIGUSR1,s_usr1);
}

main()....
        (void)signal(SIGUSR1,s_usr1);

        /* The accept loop */

        while(!do_exit && FCGI_Accept() >= 0) {
		...
        }
        FCGI_Finish();	/* end of loop */
}
=============
For a less active app you might try

void s_usr1() {
        FCGI_Finish();
        exit(0);
}

although I don't know if it works everywhere.
-- 
Tom Neff			Bloomberg, L.P.
<tneff@bloomberg.com>