You can't KILL a script, start a new instance of that script and pass open TCP socket connections from the deceased script to the new process easily.
Agreed.
You say reload the script completely but you don't seem to want that. You want to reinitialize some stuff but keep some stuff in the running code.
Depending on the code, and based on the OP's question, it may be sufficient to reload any modules that have changed on disk, and perhaps also any configuration files.
Tachyon's earlier post gives a good skeleton for this; what's missing is something to reload any modules that have changed. I think that a hacked copy of Apache::StatINC would do the job -- take the code from handler sub, without the first four lines which are Apache-specific.
However, note that reloading the code this way is a bit unusual, and some of your code may need to be readjusted a bit to avoid some "gotchas," such as re-initializing package variables, leaving dangling references to old data, or other unexpected surprises.
In reply to Re: Re: Re: Restarting a script without dropping clients
by simonm
in thread Restarting a script without dropping clients
by Ahbeyra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |