add config for scheduled tasks
This commit is contained in:
@@ -8,7 +8,7 @@ use Role::Tiny;
|
||||
use namespace::clean;
|
||||
|
||||
# add dispatch methods for poller tasks
|
||||
with 'App::Netdisco::Daemon::Worker::Poller::Discover';
|
||||
# with 'App::Netdisco::Daemon::Worker::Poller::Discover';
|
||||
|
||||
sub worker_body {
|
||||
my $self = shift;
|
||||
|
||||
@@ -31,10 +31,10 @@ sub worker_begin {
|
||||
my $config = setting('housekeeping')->{$a};
|
||||
|
||||
# accept either single crontab format, or individual time fields
|
||||
my $cron = Algorithm::Cron->new(@{
|
||||
ref [] eq ref $config->{when}
|
||||
my $cron = Algorithm::Cron->new(%{
|
||||
ref {} eq ref $config->{when}
|
||||
? $config->{when}
|
||||
: [crontab => $config->{when}];
|
||||
: {crontab => $config->{when}}
|
||||
});
|
||||
|
||||
$jobactions->{$a} = $config;
|
||||
@@ -71,7 +71,7 @@ sub worker_body {
|
||||
schema('netdisco')->resultset('Admin')->create({
|
||||
action => $a,
|
||||
device => ($sched->{device} || undef),
|
||||
subaction => ($sched->{extra} || undef),
|
||||
subaction => ($sched->{param} || undef),
|
||||
status => 'queued',
|
||||
});
|
||||
};
|
||||
|
||||
@@ -70,8 +70,32 @@ portctl_vlans: 1
|
||||
# sleep time between polls of the database job queue
|
||||
daemon_sleep_time: 5
|
||||
|
||||
# how many daemon processes
|
||||
# NB one worker will always be a Queue Manager
|
||||
# how many daemon processes for this node
|
||||
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