add config for scheduled tasks
This commit is contained in:
@@ -8,7 +8,7 @@ use Role::Tiny;
|
|||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
|
|
||||||
# add dispatch methods for poller tasks
|
# add dispatch methods for poller tasks
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Discover';
|
# with 'App::Netdisco::Daemon::Worker::Poller::Discover';
|
||||||
|
|
||||||
sub worker_body {
|
sub worker_body {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ sub worker_begin {
|
|||||||
my $config = setting('housekeeping')->{$a};
|
my $config = setting('housekeeping')->{$a};
|
||||||
|
|
||||||
# accept either single crontab format, or individual time fields
|
# accept either single crontab format, or individual time fields
|
||||||
my $cron = Algorithm::Cron->new(@{
|
my $cron = Algorithm::Cron->new(%{
|
||||||
ref [] eq ref $config->{when}
|
ref {} eq ref $config->{when}
|
||||||
? $config->{when}
|
? $config->{when}
|
||||||
: [crontab => $config->{when}];
|
: {crontab => $config->{when}}
|
||||||
});
|
});
|
||||||
|
|
||||||
$jobactions->{$a} = $config;
|
$jobactions->{$a} = $config;
|
||||||
@@ -71,7 +71,7 @@ sub worker_body {
|
|||||||
schema('netdisco')->resultset('Admin')->create({
|
schema('netdisco')->resultset('Admin')->create({
|
||||||
action => $a,
|
action => $a,
|
||||||
device => ($sched->{device} || undef),
|
device => ($sched->{device} || undef),
|
||||||
subaction => ($sched->{extra} || undef),
|
subaction => ($sched->{param} || undef),
|
||||||
status => 'queued',
|
status => 'queued',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -70,8 +70,32 @@ portctl_vlans: 1
|
|||||||
# sleep time between polls of the database job queue
|
# sleep time between polls of the database job queue
|
||||||
daemon_sleep_time: 5
|
daemon_sleep_time: 5
|
||||||
|
|
||||||
# how many daemon processes
|
# how many daemon processes for this node
|
||||||
# NB one worker will always be a Queue Manager
|
|
||||||
daemon_interactives: 2
|
daemon_interactives: 2
|
||||||
daemon_pollers: 0
|
daemon_pollers: 2
|
||||||
|
|
||||||
|
# what housekeeping tasks should this node *schedule*
|
||||||
|
# (it only does them if daemon_pollers is non-zero)
|
||||||
|
#housekeeping:
|
||||||
|
# discoverall:
|
||||||
|
# device: '192.0.2.0'
|
||||||
|
# when:
|
||||||
|
# wday: 'wed'
|
||||||
|
# hour: 14
|
||||||
|
# backup:
|
||||||
|
# when:
|
||||||
|
# hour: 1
|
||||||
|
# refresh:
|
||||||
|
# when: '0 9 * * *'
|
||||||
|
# arpwalk:
|
||||||
|
# when:
|
||||||
|
# min: 30
|
||||||
|
# macwalk:
|
||||||
|
# when:
|
||||||
|
# hour: '*/2'
|
||||||
|
# nbtwalk:
|
||||||
|
# when:
|
||||||
|
# hour: '8,13,21'
|
||||||
|
# saveconfigs:
|
||||||
|
# param: 61
|
||||||
|
# when: '0 * * * *'
|
||||||
|
|||||||
Reference in New Issue
Block a user