]> granicus.if.org Git - cronie/commitdiff
Add daily, weekly as a possibility of anacrontab configuration.
authorMarcela Mašláňová <mmaslano@redhat.com>
Mon, 17 Aug 2009 13:11:41 +0000 (15:11 +0200)
committerMarcela Mašláňová <mmaslano@redhat.com>
Mon, 17 Aug 2009 13:11:41 +0000 (15:11 +0200)
anacron/lock.c
anacron/readtab.c
man/anacrontab.5

index 51a4c3d3d771fb88edfd2fba00b777d28a9b96fc..68fd25296006d30d9046226306fddbed704d4851 100644 (file)
@@ -122,14 +122,22 @@ consider_job(job_rec *jr)
            int period = 0, bypass = 0;
            switch (jr->named_period)
            {
-               case 1:
+               case 1: /* monthly */
                    period = days_last_month ();
                    bypass = days_this_month ();
                    break;
-               case 2:
+               case 2: /* yearly, annualy */
                    period = days_last_year ();
                    bypass = days_this_year ();
                    break;
+               case 3: /* daily */
+                       period = 1;
+                       bypass = 1;
+                       break;
+               case 4: /* weekly */
+                       period = 7;
+                       bypass = 7;
+                       break;
                default:
                    die ("Unknown named period for %s (%d)", jr->ident, jr->named_period);
            }
index 68b588b21aea2d2a2f2d82bac135643da67aa5b2..aa9eb93867ddc588a473920151bbb974a179355e 100644 (file)
@@ -210,12 +210,16 @@ register_period_job(const char *periods, const char *delays,
 
     jr = obstack_alloc(&tab_o, sizeof(job_rec));
     if (!strncmp ("@monthly", periods, 7)) {
-       jr->named_period = 1;
-    } else if (!strncmp("@yearly", periods, 7)) {
-       jr->named_period = 2;
+               jr->named_period = 1;
+    } else if (!strncmp("@yearly", periods, 7) || !strncmp("@annualy", periods, 8)) {
+               jr->named_period = 2;
+       } else if (!strncmp ("@daily", periods, 7)) {
+               jr->named_period = 3;
+       } else if (!strncmp ("@weekly", periods, 7)) {
+               jr->named_period = 4;
     } else {
-       complain("%s: Unknown named period on line %d, skipping",
-                anacrontab, line_num);
+               complain("%s: Unknown named period on line %d, skipping",
+                        anacrontab, line_num);
     }
     jr->period = 0;
     delay += random_number;
index 488a1797e24add89eaeb326a21865bd795923798..f82930446a2e7f1aeeb0bc45a172ff0934f97cb3 100644 (file)
@@ -1,4 +1,4 @@
-.TH ANACRONTAB 5 2009-07-17 "Marcela Mašláňová" "Anacron Users' Manual"
+.TH ANACRONTAB 5 2009-08-17 "Marcela Mašláňová" "Anacron Users' Manual"
 .SH NAME
 /etc/anacrontab \- configuration file for anacron
 .SH DESCRIPTION
@@ -37,9 +37,8 @@ and as the name for the job's timestamp file.  The
 can be any shell command. The fields can be seperated by blank spaces or tabs.
 The
 .I period_name
-can only be set to monthly at the present time. This will ensure jobs
-are only run once a month, no matter the number of days in this month,
-or the previous month.
+can be set to daily, weekly, monthly, yearly or annualy. This will ensure jobs
+are run once a week, month or year no matter the number of days in this period.
 .PP
 Environment assignment lines are of the form:
 .PP