Process tree updated to show daemon worker status/activity

Squashed commit of the following:

commit a785b88b43
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Aug 6 21:32:11 2014 +0100

    complete daemon pstree updates

commit f77bf5361f
Merge: f519410 fcb8195
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Aug 6 20:45:22 2014 +0100

    Merge branch 'master' into og-proctitle

commit f51941076f
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Aug 5 22:14:58 2014 +0100

    set proctitle on daemon
This commit is contained in:
Oliver Gorwits
2014-08-06 21:33:41 +01:00
parent fcb8195e58
commit 5d23338cbd
8 changed files with 80 additions and 8 deletions

View File

@@ -29,7 +29,6 @@ use NetAddr::IP::Lite ':lower';
use List::Util 'sum';
use Role::Tiny::With;
use MCE::Signal '-setpgrp';
setpgrp(0,0); # only portable variety of setpgrp
use MCE;
# set temporary MCE files' location in home directory
@@ -37,6 +36,9 @@ my $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
my $tmp_dir = ($ENV{NETDISCO_TEMP} || dir($home, 'tmp'));
mkdir $tmp_dir if ! -d $tmp_dir;
setpgrp(0,0); # only portable variety of setpgrp
$0 = 'netdisco-daemon: master';
my $mce = MCE->new(
spawn_delay => 0.15,
job_delay => 1.15,
@@ -92,6 +94,7 @@ sub worker_factory {
return sub {
my $self = shift;
my $wid = $self->wid;
$0 = sprintf 'netdisco-daemon: worker #%s %s: init', $wid, lc($role);
info "applying role $role to worker $wid";
# $self->sendto('stderr', ">>> worker $wid starting with role $role\n");