mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-15 11:32:41 +00:00
pvescheduler: run jobs from jobs.cfg
PVE/Jobs is responsible to decide if the job must run (e.g. with a schedule) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
76c6ee8a6f
commit
fa7d54564a
@ -6,6 +6,7 @@ use warnings;
|
|||||||
use POSIX qw(WNOHANG);
|
use POSIX qw(WNOHANG);
|
||||||
use PVE::SafeSyslog;
|
use PVE::SafeSyslog;
|
||||||
use PVE::API2::Replication;
|
use PVE::API2::Replication;
|
||||||
|
use PVE::Jobs;
|
||||||
|
|
||||||
use PVE::Daemon;
|
use PVE::Daemon;
|
||||||
use base qw(PVE::Daemon);
|
use base qw(PVE::Daemon);
|
||||||
@ -51,19 +52,31 @@ sub run {
|
|||||||
$old_sig_chld->(@_) if $old_sig_chld;
|
$old_sig_chld->(@_) if $old_sig_chld;
|
||||||
};
|
};
|
||||||
|
|
||||||
my $run_jobs = sub {
|
my $fork = sub {
|
||||||
|
my ($sub) = @_;
|
||||||
my $child = fork();
|
my $child = fork();
|
||||||
if (!defined($child)) {
|
if (!defined($child)) {
|
||||||
die "fork failed: $!\n";
|
die "fork failed: $!\n";
|
||||||
} elsif ($child == 0) {
|
} elsif ($child == 0) {
|
||||||
$self->after_fork_cleanup();
|
$self->after_fork_cleanup();
|
||||||
PVE::API2::Replication::run_jobs(undef, sub {}, 0, 1);
|
$sub->();
|
||||||
POSIX::_exit(0);
|
POSIX::_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$jobs->{$child} = 1;
|
$jobs->{$child} = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
my $run_jobs = sub {
|
||||||
|
|
||||||
|
$fork->(sub {
|
||||||
|
PVE::API2::Replication::run_jobs(undef, sub {}, 0, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
$fork->(sub {
|
||||||
|
PVE::Jobs::run_jobs();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
PVE::Jobs::setup_dirs();
|
PVE::Jobs::setup_dirs();
|
||||||
|
|
||||||
for (my $count = 1000;;$count++) {
|
for (my $count = 1000;;$count++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user