portable setting of proctitle
This commit is contained in:
@@ -6,7 +6,6 @@ use warnings;
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
use Path::Class 'dir';
|
||||
use Sys::Proctitle 'setproctitle';
|
||||
|
||||
BEGIN {
|
||||
# stuff useful locations into @INC
|
||||
@@ -24,6 +23,7 @@ warning sprintf "App::Netdisco %s backend", ($App::Netdisco::VERSION || 'HEAD');
|
||||
|
||||
# local job queue management
|
||||
use App::Netdisco::Daemon::LocalQueue ':all';
|
||||
use App::Netdisco::Util::Daemon;
|
||||
|
||||
# needed to quench AF_INET6 symbol errors
|
||||
use NetAddr::IP::Lite ':lower';
|
||||
@@ -38,7 +38,7 @@ my $tmp_dir = ($ENV{NETDISCO_TEMP} || dir($home, 'tmp'));
|
||||
mkdir $tmp_dir if ! -d $tmp_dir;
|
||||
|
||||
setpgrp(0,0); # only portable variety of setpgrp
|
||||
setproctitle 'netdisco-daemon: master';
|
||||
prctl 'netdisco-daemon: master';
|
||||
|
||||
my $mce = MCE->new(
|
||||
spawn_delay => 0.15,
|
||||
@@ -95,7 +95,7 @@ sub worker_factory {
|
||||
return sub {
|
||||
my $self = shift;
|
||||
my $wid = $self->wid;
|
||||
setproctitle sprintf 'netdisco-daemon: worker #%s %s: init', $wid, lc($role);
|
||||
prctl 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");
|
||||
|
||||
Reference in New Issue
Block a user