rpms/anacron/devel anacron-2.3-log_jobs_correct.patch, NONE, 1.1 anacron-2.3-random.patch, 1.2, 1.3 anacron-2.3-range.patch, 1.2, 1.3 anacron.spec, 1.59, 1.60 anacrontab, 1.7, 1.8

Marcela Mašláňová mmaslano at fedoraproject.org
Thu Feb 19 14:06:20 UTC 2009


Author: mmaslano

Update of /cvs/pkgs/rpms/anacron/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15757

Modified Files:
	anacron-2.3-random.patch anacron-2.3-range.patch anacron.spec 
	anacrontab 
Added Files:
	anacron-2.3-log_jobs_correct.patch 
Log Message:
* Thu Feb 19 2009 Marcela Mašláňová <mmaslano at redhat.com> 2.3-70
- incorrect logging of jobs - fixed number of executed jobs
                            - really planed jobs are mentioned
- 252254 fix typo in bash script 0anacron


anacron-2.3-log_jobs_correct.patch:

--- NEW FILE anacron-2.3-log_jobs_correct.patch ---
diff -up anacron-2.3/global.h.fix anacron-2.3/global.h
--- anacron-2.3/global.h.fix	2009-02-19 12:27:33.000000000 +0100
+++ anacron-2.3/global.h	2009-02-19 12:27:33.000000000 +0100
@@ -100,6 +100,10 @@ extern int running_jobs,running_mailers;
 
 extern int complaints;
 
+extern char *range_hours;
+
+extern int drop_job;
+
 /* Function prototypes */
 
 /* main.c */
diff -up anacron-2.3/main.c.fix anacron-2.3/main.c
--- anacron-2.3/main.c.fix	2009-02-19 12:27:33.000000000 +0100
+++ anacron-2.3/main.c	2009-02-19 12:33:04.000000000 +0100
@@ -34,6 +34,7 @@
 #include <string.h>
 #include "global.h"
 #include "gregor.h"
+#include <fnmatch.h>
 
 pid_t primary_pid;
 int day_now;
@@ -57,6 +58,8 @@ env_rec *first_env_rec;
 static time_t start_sec;                       /* time anacron started */
 static volatile int got_sigalrm, got_sigchld, got_sigusr1;
 int running_jobs, running_mailers;              /* , number of */
+char *range_hours = NULL;
+int drop_job = 0;
 
 static void
 print_version()
@@ -402,22 +405,58 @@ fake_jobs()
 static void
 explain_intentions()
 {
-    int j;
+    int j, minute, hour;
+    time_t whichtime;
+    struct tm *t;
+    char *from;
+    char *to;
 
     j = 0;
-    while (j < njobs)
-    {
-	if (now)
-	{
-	    explain("Will run job `%s'", job_array[j]->ident);
-	}
-	else
-	{
-	    explain("Will run job `%s' in %d min.",
-		    job_array[j]->ident, job_array[j]->delay);
-	}
-	j++;
+    time(&whichtime);
+    t = localtime(&whichtime);
+    /* add delay to actual time for time ranges */
+    if (range_hours != NULL) {
+        if ((match_rx("([[:digit:]]+)-([[:digit:]]+)", range_hours, 2, &from, &to) == -1) ||
+            (from == NULL) || (to == NULL))
+        {
+            complain("START_HOURS_RANGE wasn't set correctly: %s", range_hours);
+            goto free_range;
+        }
+    }
+    while (j < njobs) {
+        minute = job_array[j]->delay + t->tm_min;
+        if (minute >= 60) {
+            hour = minute/60;
+            if (hour > 0)
+                t->tm_hour = t->tm_hour + hour; /* add how many hours has delay to actual hour */
+            explain("hour after sum %d, hour %d", t->tm_hour, hour);
+        }
+        else hour = 0;
+
+        if (!((atoi(from) < t->tm_hour) && (t->tm_hour < atoi(to))))
+        {
+            Debug(("Limit for start of job is set between %s and %s hours, which passed already.", from, to));
+            goto free_range;
+        }
+
+        if (now)
+        {
+            explain("Will run job `%s'", job_array[j]->ident);
+        }
+        else
+        {
+            explain("Will run job `%s' in %d min.",
+               job_array[j]->ident, job_array[j]->delay);
+        }
+        j++;
+    }
+
+  free_range:
+    if (range_hours != NULL) {
+        free(range_hours);
+        return;
     }
+
     if (serialize && njobs > 0)
 	explain("Jobs will be executed sequentially");
 }
@@ -499,6 +538,6 @@ main(int argc, char *argv[])
 	launch_job(job_array[j]);
     }
     wait_children();
-    explain("Normal exit (%d job%s run)", njobs, (njobs == 1 ? "" : "s"));
+    explain("Normal exit (%d job%s run)", njobs-drop_job, (njobs == 1 ? "" : "s"));
     exit(0);
 }
diff -up anacron-2.3/readtab.c.fix anacron-2.3/readtab.c
--- anacron-2.3/readtab.c.fix	2009-02-19 12:27:33.000000000 +0100
+++ anacron-2.3/readtab.c	2009-02-19 12:27:33.000000000 +0100
@@ -277,6 +277,7 @@ parse_tab_line(char *line)
         {
             r = match_rx("^([[:digit:]]+-[[:digit:]]+)$", value, 0);
             if (r == -1) goto reg_invalid;
+            range_hours = strdup(value);
         }
         if (strncmp(env_var, "RANDOM_DELAY", 12) == NULL) {
             r = match_rx("^([[:digit:]]+)$", value, 1);
diff -up anacron-2.3/runjob.c.fix anacron-2.3/runjob.c
--- anacron-2.3/runjob.c.fix	2009-02-19 12:27:33.000000000 +0100
+++ anacron-2.3/runjob.c	2009-02-19 12:27:33.000000000 +0100
@@ -266,6 +266,7 @@ launch_job(job_rec *jr)
         if (!((atoi(from) < t->tm_hour) && (t->tm_hour < atoi(to))))
         {
             Debug(("Limit for start of job is set between %s and %s hours, which passed already.", from, to));
+            drop_job += 1;
             free(limit);
             return;
         }

anacron-2.3-random.patch:

Index: anacron-2.3-random.patch
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacron-2.3-random.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- anacron-2.3-random.patch	10 Feb 2009 09:58:12 -0000	1.2
+++ anacron-2.3-random.patch	19 Feb 2009 14:06:19 -0000	1.3
@@ -1,6 +1,6 @@
 diff -up anacron-2.3/main.c.random anacron-2.3/main.c
---- anacron-2.3/main.c.random	2009-02-10 10:22:07.000000000 +0100
-+++ anacron-2.3/main.c	2009-02-10 10:22:07.000000000 +0100
+--- anacron-2.3/main.c.random	2009-02-16 10:27:46.000000000 +0100
++++ anacron-2.3/main.c	2009-02-16 10:27:46.000000000 +0100
 @@ -24,6 +24,7 @@
  
  
@@ -24,8 +24,8 @@
      if((program_name = strrchr(argv[0], '/')) == NULL)
  	program_name = argv[0];
 diff -up anacron-2.3/readtab.c.random anacron-2.3/readtab.c
---- anacron-2.3/readtab.c.random	2009-02-10 10:22:07.000000000 +0100
-+++ anacron-2.3/readtab.c	2009-02-10 10:23:10.000000000 +0100
+--- anacron-2.3/readtab.c.random	2009-02-16 10:27:46.000000000 +0100
++++ anacron-2.3/readtab.c	2009-02-16 10:30:05.000000000 +0100
 @@ -48,6 +48,8 @@ static int line_num;             /* curr
  static job_rec *last_job_rec;    /* last job stored in memory, at the moment */
  static env_rec *last_env_rec;    /* last environment assignment stored */
@@ -69,14 +69,14 @@
      jr->delay = delay;
      jr->tab_line = line_num;
      jr->ident = obstack_alloc(&tab_o, ident_len + 1);
-@@ -258,6 +273,10 @@ parse_tab_line(char *line)
-     if (r == -1) goto reg_err;
-     if (r)
-     {
+@@ -263,6 +278,10 @@ parse_tab_line(char *line)
+             r = match_rx("^([[:digit:]]+-[[:digit:]]+)$", value, 0);
+             if (r == -1) goto reg_invalid;
+         }
 +        if (strncmp(env_var, "RANDOM_DELAY", 12) == NULL) {
-+            r = match_rx("([[:digit:]]+)$", value, 1);
++            r = match_rx("^([[:digit:]]+)$", value, 1);
 +            RANDOM = atoi(value);
 +        }
-         if (strcmp(env_var, "START_HOURS_RANGE") == 0)
-         {
-             r = match_rx("^[[:digit:]]+-[[:digit:]]+$", value, 0);
+ 	register_env(env_var, value);
+ 	return;
+     }

anacron-2.3-range.patch:

Index: anacron-2.3-range.patch
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacron-2.3-range.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- anacron-2.3-range.patch	10 Feb 2009 09:58:12 -0000	1.2
+++ anacron-2.3-range.patch	19 Feb 2009 14:06:19 -0000	1.3
@@ -1,27 +1,29 @@
 diff -up anacron-2.3/readtab.c.range anacron-2.3/readtab.c
---- anacron-2.3/readtab.c.range	2009-02-10 09:20:53.000000000 +0100
-+++ anacron-2.3/readtab.c	2009-02-10 09:33:38.000000000 +0100
-@@ -258,6 +258,17 @@ parse_tab_line(char *line)
+--- anacron-2.3/readtab.c.range	2009-02-16 10:20:08.000000000 +0100
++++ anacron-2.3/readtab.c	2009-02-16 10:25:15.000000000 +0100
+@@ -258,6 +258,11 @@ parse_tab_line(char *line)
      if (r == -1) goto reg_err;
      if (r)
      {
 +        if (strcmp(env_var, "START_HOURS_RANGE") == 0)
 +        {
-+            r = match_rx("^[[:digit:]]+-[[:digit:]]+$", value, 0);
-+            if (r == -1) goto reg_err;
-+            if (!r)
-+            {
-+                complain("Invalid syntax in %s of value %s on line %d - skipping this line",
-+                         anacrontab, env_var, line_num);
-+                return;
-+            }
++            r = match_rx("^([[:digit:]]+-[[:digit:]]+)$", value, 0);
++            if (r == -1) goto reg_invalid;
 +        }
  	register_env(env_var, value);
  	return;
      }
+@@ -284,6 +289,7 @@ parse_tab_line(char *line)
+ 	return;
+     }
+ 
++ reg_invalid:
+     complain("Invalid syntax in %s on line %d - skipping this line",
+ 	     anacrontab, line_num);
+     return;
 diff -up anacron-2.3/runjob.c.range anacron-2.3/runjob.c
---- anacron-2.3/runjob.c.range	2009-02-10 09:20:53.000000000 +0100
-+++ anacron-2.3/runjob.c	2009-02-10 09:40:48.000000000 +0100
+--- anacron-2.3/runjob.c.range	2009-02-16 10:20:08.000000000 +0100
++++ anacron-2.3/runjob.c	2009-02-16 10:20:08.000000000 +0100
 @@ -34,8 +34,9 @@
  #include <stdio.h>
  #include <string.h>


Index: anacron.spec
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacron.spec,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- anacron.spec	10 Feb 2009 09:58:12 -0000	1.59
+++ anacron.spec	19 Feb 2009 14:06:19 -0000	1.60
@@ -1,7 +1,7 @@
 Summary: A cron-like program that can run jobs lost during downtime
 Name: anacron
 Version: 2.3
-Release: 69%{?dist}
+Release: 70%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 URL: http://packages.debian.org/stable/source/anacron
@@ -18,6 +18,7 @@
 Patch7: anacron-2.3-range.patch
 Patch8: anacron-2.3-random.patch
 Patch9: manAUX_Limit.patch
+Patch10: anacron-2.3-log_jobs_correct.patch
 
 Requires: crontabs
 Requires: initscripts
@@ -53,6 +54,7 @@
 %patch7 -p1 -b .range
 %patch8 -p1 -b .random
 %patch9 -p1
+%patch10 -p1 -b .fix
 
 %build
 make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
@@ -90,6 +92,11 @@
 %attr(755,root,root) /etc/cron.hourly/0anacron
 
 %changelog
+* Thu Feb 19 2009 Marcela Mašláňová <mmaslano at redhat.com> 2.3-70
+- incorrect logging of jobs - fixed number of executed jobs
+                            - really planed jobs are mentioned
+- 252254 fix typo in bash script 0anacron
+
 * Tue Feb 10 2009 Marcela Mašláňová <mmaslano at redhat.com> 2.3-69
 - apply fix of my previous range patch from tmraz
 - fix man page


Index: anacrontab
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacrontab,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- anacrontab	10 Feb 2009 09:58:12 -0000	1.7
+++ anacrontab	19 Feb 2009 14:06:19 -0000	1.8
@@ -10,6 +10,7 @@
 # the jobs will be started during the following hours only
 START_HOURS_RANGE=3-22
 
+#period in days   delay in minutes   job-identifier   command
 1	5	cron.daily		nice run-parts /etc/cron.daily
 7	25	cron.weekly		nice run-parts /etc/cron.weekly
 @monthly 45	cron.monthly		nice run-parts /etc/cron.monthly




More information about the scm-commits mailing list