Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to kill/restart a HTTP::Daemon perl script properly.

5 views
Skip to first unread message

Jim Lynch

unread,
May 28, 2020, 3:30:02 PM5/28/20
to lib...@perl.org
I've written a small HTTP server using the HTTP::Daemon module and am
wanting to also generate a systemd service (please no flames :) for it. 
I know that it, my script, forks multiple children and I see in the
sample code that I used as a template, it keeps the pids in a hash.  I
suspect I can trap the signal that "systemctl stop xxx" throws and
iterate through that hash to kill them off one by one.  I know that
killing the original process ID with HUP doesn't terminate the children
so before I waste a whole lot of time I thought I'd ask someone who
knows more about the "proper" way to do it.

I did see something about SIG but I didn't quite understand what it was
doing.  I did try to kill the original process with TERM since it was
mentioned, but that didn't work either.

Thanks for any info.

Jim.

Bernard CLABOTS via libwww

unread,
Jun 3, 2020, 12:00:03 PM6/3/20
to lib...@perl.org
Hi,
   Maybe this helps:

I think you can "catch" the signal sent by system to cleanly exit.

Maybe you can then combine this with the following:

That should allow you to remove the child processes as well if you maintain an internal list of their pid's.

I hope that helps.

Bernard



0 new messages