Problem:
scriptA.cgi is sitting in an infinite loop and handling an open socket to a Flash client.
scriptB.cgi is called from the web, does what it needs to do and then needs to inform scriptA to send a message to the client.
Is this possible? I’m stuck on how to have scriptB identify the instance of scriptA that is sitting there with the socket connection, rather than launching one of its own.
all thoughts appreciated.
If the communication needs are simple, this is a good application for signals.
Edited to store process id from scriptA and read it in scriptB — scripts A and B have to agree on a name.
When script A receives a
SIGUSR1signal, the script will be interrupted to run theUSR1signal handler, setting$signaled. The thread of execution will then resume and the script can use the information.