rename daemon to backend in code
This commit is contained in:
@@ -46,21 +46,21 @@ use File::Copy;
|
||||
use App::Netdisco::Environment;
|
||||
my $config = ($ENV{PLACK_ENV} || $ENV{DANCER_ENVIRONMENT}) .'.yml';
|
||||
|
||||
my $netdisco = file($FindBin::RealBin, 'netdisco-daemon-fg');
|
||||
my $netdisco = file($FindBin::RealBin, 'netdisco-backend-fg');
|
||||
my @args = (scalar @ARGV > 1 ? @ARGV[1 .. $#ARGV] : ());
|
||||
|
||||
my $log_dir = dir($home, 'logs');
|
||||
mkdir $log_dir if ! -d $log_dir;
|
||||
my $log_file = file($log_dir, 'netdisco-daemon.log');
|
||||
my $log_file = file($log_dir, 'netdisco-backend.log');
|
||||
|
||||
my $uid = (stat($netdisco->stringify))[4] || 0;
|
||||
my $gid = (stat($netdisco->stringify))[5] || 0;
|
||||
|
||||
Daemon::Control->new({
|
||||
name => 'Netdisco Daemon',
|
||||
name => 'Netdisco Backend',
|
||||
program => \&restarter,
|
||||
program_args => [@args],
|
||||
pid_file => file($home, 'netdisco-daemon.pid'),
|
||||
pid_file => file($home, 'netdisco-backend.pid'),
|
||||
stderr_file => $log_file,
|
||||
stdout_file => $log_file,
|
||||
redirect_before_fork => 0,
|
||||
@@ -72,7 +72,7 @@ my $child = 0;
|
||||
|
||||
sub restarter {
|
||||
my ($daemon, @program_args) = @_;
|
||||
$0 = 'netdisco-daemon';
|
||||
$0 = 'netdisco-backend';
|
||||
|
||||
$child = fork_and_start($daemon, @program_args);
|
||||
exit(1) unless $child;
|
||||
@@ -171,7 +171,7 @@ sub rotate_logs {
|
||||
|
||||
=head1 NAME
|
||||
|
||||
netdisco-daemon - Job Control Daemon for Netdisco
|
||||
netdisco-backend - Job Control Daemon for Netdisco
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
|
||||
@@ -24,25 +24,25 @@ use App::Netdisco;
|
||||
use Dancer qw/:moose :script/;
|
||||
warning sprintf "App::Netdisco %s backend", ($App::Netdisco::VERSION || 'HEAD');
|
||||
|
||||
use App::Netdisco::Util::Daemon;
|
||||
use App::Netdisco::Util::Backend;
|
||||
use NetAddr::IP::Lite ':lower'; # to quench AF_INET6 symbol errors
|
||||
use Role::Tiny::With;
|
||||
|
||||
# preload all worker modules into shared memory
|
||||
use App::Netdisco::Daemon::Job ();
|
||||
use App::Netdisco::Daemon::Util ();
|
||||
use App::Netdisco::Daemon::Worker::Common ();
|
||||
use App::Netdisco::Daemon::Worker::Interactive::DeviceActions ();
|
||||
use App::Netdisco::Daemon::Worker::Interactive::PortActions ();
|
||||
use App::Netdisco::Daemon::Worker::Manager ();
|
||||
use App::Netdisco::Daemon::Worker::Poller::Arpnip ();
|
||||
use App::Netdisco::Daemon::Worker::Poller::Common ();
|
||||
use App::Netdisco::Daemon::Worker::Poller::Device ();
|
||||
use App::Netdisco::Daemon::Worker::Poller::Expiry ();
|
||||
use App::Netdisco::Daemon::Worker::Poller::Macsuck ();
|
||||
use App::Netdisco::Daemon::Worker::Poller::Nbtstat ();
|
||||
use App::Netdisco::Daemon::Worker::Poller ();
|
||||
use App::Netdisco::Daemon::Worker::Scheduler ();
|
||||
use App::Netdisco::Backend::Job ();
|
||||
use App::Netdisco::Backend::Util ();
|
||||
use App::Netdisco::Backend::Worker::Common ();
|
||||
use App::Netdisco::Backend::Worker::Interactive::DeviceActions ();
|
||||
use App::Netdisco::Backend::Worker::Interactive::PortActions ();
|
||||
use App::Netdisco::Backend::Worker::Manager ();
|
||||
use App::Netdisco::Backend::Worker::Poller::Arpnip ();
|
||||
use App::Netdisco::Backend::Worker::Poller::Common ();
|
||||
use App::Netdisco::Backend::Worker::Poller::Device ();
|
||||
use App::Netdisco::Backend::Worker::Poller::Expiry ();
|
||||
use App::Netdisco::Backend::Worker::Poller::Macsuck ();
|
||||
use App::Netdisco::Backend::Worker::Poller::Nbtstat ();
|
||||
use App::Netdisco::Backend::Worker::Poller ();
|
||||
use App::Netdisco::Backend::Worker::Scheduler ();
|
||||
|
||||
use MCE::Signal '-setpgrp';
|
||||
use MCE::Flow Sereal => 1;
|
||||
@@ -54,7 +54,7 @@ my $tmp_dir = ($ENV{NETDISCO_TEMP} || dir($home, 'tmp'));
|
||||
mkdir $tmp_dir if ! -d $tmp_dir;
|
||||
|
||||
# process-table text
|
||||
prctl 'netdisco-daemon: master';
|
||||
prctl 'netdisco-backend: master';
|
||||
|
||||
# shared local job queue
|
||||
my $queue = MCE::Queue->new;
|
||||
@@ -80,12 +80,12 @@ sub _mk_wkr {
|
||||
my $self = shift;
|
||||
$self->{queue} = $queue;
|
||||
|
||||
prctl sprintf 'netdisco-daemon: worker #%s %s: init', MCE->wid, lc($role);
|
||||
prctl sprintf 'netdisco-backend: worker #%s %s: init', MCE->wid, lc($role);
|
||||
info sprintf 'applying role %s to worker %s', $role, MCE->wid;
|
||||
|
||||
# post-fork, become manager, scheduler, poller, etc
|
||||
Role::Tiny->apply_roles_to_object(
|
||||
$self => "App::Netdisco::Daemon::Worker::$role");
|
||||
$self => "App::Netdisco::Backend::Worker::$role");
|
||||
|
||||
$self->worker_begin if $self->can('worker_begin');
|
||||
$self->worker_body;
|
||||
@@ -94,7 +94,7 @@ sub _mk_wkr {
|
||||
|
||||
=head1 NAME
|
||||
|
||||
netdisco-daemon-fg - Job Control for Netdisco
|
||||
netdisco-backend-fg - Job Control for Netdisco
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
|
||||
Reference in New Issue
Block a user