From: Marcela Mašláňová Date: Mon, 17 Aug 2009 13:11:41 +0000 (+0200) Subject: Add daily, weekly as a possibility of anacrontab configuration. X-Git-Tag: cronie1.4.2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6537f2b7511edb1a40bf897c4bb9ad52e73cc760;p=cronie Add daily, weekly as a possibility of anacrontab configuration. --- diff --git a/anacron/lock.c b/anacron/lock.c index 51a4c3d..68fd252 100644 --- a/anacron/lock.c +++ b/anacron/lock.c @@ -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); } diff --git a/anacron/readtab.c b/anacron/readtab.c index 68b588b..aa9eb93 100644 --- a/anacron/readtab.c +++ b/anacron/readtab.c @@ -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; diff --git a/man/anacrontab.5 b/man/anacrontab.5 index 488a179..f829304 100644 --- a/man/anacrontab.5 +++ b/man/anacrontab.5 @@ -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