in reply to forking from web
Don't take it from me, but this might not be possible without writing an apache module or something. You might be well served with using IPC of some sort. If it's simple, you can just use signals to contact a daemon in the background to tell it to fork(). Read the perl manpage on signals first, but it's pretty simple:
# in the daemon
$SIG{'INT'} = \&signal_handler;
sub singnal_handler {
# we don't want to do anything too complex in the handler
# or we risk an ugly death
$fork_now = 1;
}
# then just test $fork_now in the main loop of your daemon
# to fork when it's set (then unset it immediately)
# in the calling process:
kill -2 $pid; # sends SIGINT to $pid.
If you need the daemon to get more complicated information than a simple signal, you should explore other forms of IPC like sockets or SysV message queues and what not. I've used signals with a web board on a daemon which updates semi-static content and things to force it to update or re-read config information and it works quite well.
Hope that helps.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: forking from web
by reptile (Monk) on Apr 23, 2000 at 03:31 UTC |