- do not lock jobs that fall out of allowed range - 661966
This commit is contained in:
parent
98378995c8
commit
e987620d6a
134
cronie-1.4.6-anacron-locks.patch
Normal file
134
cronie-1.4.6-anacron-locks.patch
Normal file
@ -0,0 +1,134 @@
|
||||
diff --git a/anacron/global.h b/anacron/global.h
|
||||
index 91963a7..0fe3f9b 100644
|
||||
--- a/anacron/global.h
|
||||
+++ b/anacron/global.h
|
||||
@@ -42,6 +42,7 @@
|
||||
#define MAX_MSG 150
|
||||
|
||||
#include <signal.h>
|
||||
+#include <time.h>
|
||||
#include "anacron-paths.h"
|
||||
|
||||
/* Some declarations */
|
||||
@@ -102,6 +103,8 @@ extern int running_jobs,running_mailers;
|
||||
|
||||
extern int complaints;
|
||||
|
||||
+extern time_t start_sec;
|
||||
+
|
||||
/* time ranges for START_HOURS_RANGE */
|
||||
extern int range_start;
|
||||
extern int range_stop;
|
||||
diff --git a/anacron/lock.c b/anacron/lock.c
|
||||
index 68fd252..71aae09 100644
|
||||
--- a/anacron/lock.c
|
||||
+++ b/anacron/lock.c
|
||||
@@ -94,6 +94,9 @@ consider_job(job_rec *jr)
|
||||
if (!force && b == 8)
|
||||
{
|
||||
int day_delta;
|
||||
+ time_t jobtime;
|
||||
+ struct tm *t;
|
||||
+
|
||||
if (sscanf(timestamp, "%4d%2d%2d", &ts_year, &ts_month, &ts_day) == 3)
|
||||
dn = day_num(ts_year, ts_month, ts_day);
|
||||
else
|
||||
@@ -149,6 +152,18 @@ consider_job(job_rec *jr)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ jobtime = start_sec + jr->delay * 60;
|
||||
+
|
||||
+ t = localtime(&jobtime);
|
||||
+ if (!now && range_start != -1 && range_stop != -1 &&
|
||||
+ (t->tm_hour < range_start || t->tm_hour >= range_stop))
|
||||
+ {
|
||||
+ Debug(("The job `%s' falls out of the %02d:00-%02d:00 hours range, skipping.",
|
||||
+ jr->ident, range_start, range_stop));
|
||||
+ xclose (jr->timestamp_fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* no! try to grab the lock */
|
||||
diff --git a/anacron/main.c b/anacron/main.c
|
||||
index 2fd3ed5..08db810 100644
|
||||
--- a/anacron/main.c
|
||||
+++ b/anacron/main.c
|
||||
@@ -55,7 +55,7 @@ sigset_t old_sigmask; /* signal mask when started */
|
||||
job_rec *first_job_rec;
|
||||
env_rec *first_env_rec;
|
||||
|
||||
-static time_t start_sec; /* time anacron started */
|
||||
+time_t start_sec; /* time anacron started */
|
||||
static volatile int got_sigalrm, got_sigchld, got_sigusr1;
|
||||
int running_jobs, running_mailers; /* , number of */
|
||||
int range_start = -1;
|
||||
@@ -406,7 +406,6 @@ static void
|
||||
explain_intentions()
|
||||
{
|
||||
int j;
|
||||
- struct tm *t;
|
||||
|
||||
j = 0;
|
||||
while (j < njobs)
|
||||
@@ -417,21 +416,8 @@ explain_intentions()
|
||||
}
|
||||
else
|
||||
{
|
||||
- time_t jobtime = start_sec + job_array[j]->delay * 60;
|
||||
-
|
||||
- t = localtime(&jobtime);
|
||||
- if (range_start != -1 && range_stop != -1 &&
|
||||
- (t->tm_hour < range_start || t->tm_hour >= range_stop))
|
||||
- {
|
||||
- Debug(("The job `%s' falls out of the %02d:00-%02d:00 hours range, skipping.",
|
||||
- job_array[j]->ident, range_start, range_stop));
|
||||
- job_array[j]->drop_job = 1;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- explain("Will run job `%s' in %d min.",
|
||||
+ explain("Will run job `%s' in %d min.",
|
||||
job_array[j]->ident, job_array[j]->delay);
|
||||
- }
|
||||
}
|
||||
j++;
|
||||
}
|
||||
@@ -443,15 +429,12 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int j;
|
||||
-
|
||||
int cwd;
|
||||
-
|
||||
- int dropped_jobs = 0;
|
||||
+ struct timeval tv;
|
||||
+ struct timezone tz;
|
||||
|
||||
anacrontab = NULL;
|
||||
spooldir = NULL;
|
||||
- struct timeval tv;
|
||||
- struct timezone tz;
|
||||
|
||||
if (gettimeofday(&tv, &tz) != 0)
|
||||
explain("Can't get exact time, failure.");
|
||||
@@ -514,16 +497,11 @@ main(int argc, char *argv[])
|
||||
running_jobs = running_mailers = 0;
|
||||
for(j = 0; j < njobs; ++j)
|
||||
{
|
||||
- if (job_array[j]->drop_job == 1)
|
||||
- {
|
||||
- ++dropped_jobs;
|
||||
- continue;
|
||||
- }
|
||||
xsleep(time_till(job_array[j]));
|
||||
if (serialize) wait_jobs();
|
||||
launch_job(job_array[j]);
|
||||
}
|
||||
wait_children();
|
||||
- explain("Normal exit (%d job%s run)", njobs-dropped_jobs, (njobs-dropped_jobs == 1 ? "" : "s"));
|
||||
+ explain("Normal exit (%d job%s run)", njobs, njobs == 1 ? "" : "s");
|
||||
exit(0);
|
||||
}
|
@ -6,13 +6,14 @@
|
||||
Summary: Cron daemon for executing programs at set times
|
||||
Name: cronie
|
||||
Version: 1.4.6
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
License: MIT and BSD and ISC and GPLv2
|
||||
Group: System Environment/Base
|
||||
URL: https://fedorahosted.org/cronie
|
||||
Source0: https://fedorahosted.org/releases/c/r/cronie/%{name}-%{version}.tar.gz
|
||||
Source1: cronie.systemd
|
||||
Patch0: cronie-1.4.6-manpages.patch
|
||||
Patch1: cronie-1.4.6-anacron-locks.patch
|
||||
|
||||
Requires: syslog, bash >= 2.0
|
||||
Conflicts: sysklogd < 1.4.1
|
||||
@ -77,6 +78,7 @@ Old style of {hourly,daily,weekly,monthly}.jobs without anacron. No features.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
|
||||
@ -208,6 +210,9 @@ cp -a /var/lock/subsys/crond /var/lock/subsys/cronie > /dev/null 2>&1 ||:
|
||||
%attr(0644,root,root) %{_sysconfdir}/cron.d/dailyjobs
|
||||
|
||||
%changelog
|
||||
* Fri Dec 10 2010 Tomas Mraz <tmraz@redhat.com> - 1.4.6-5
|
||||
- do not lock jobs that fall out of allowed range - 661966
|
||||
|
||||
* Thu Dec 02 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-4
|
||||
- fix post (thanks plautrba for review)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user