From 065159fa73b4e38c1d1856edae92f053abe74199 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Sun, 20 Apr 2008 12:15:16 +0000 Subject: [PATCH 01/31] Initialize branch F-9 for anacron --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..1c26f78 --- /dev/null +++ b/branch @@ -0,0 +1 @@ +F-9 From 7156cbaee2ebfadbb1043a9764621bb3bdc9c1c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Wed, 28 May 2008 14:06:40 +0000 Subject: [PATCH 02/31] - cleaning lots of scripts in anacron & crontabs should lead to functional cron jobs (even with often shut down, hibernation) - change log output (too many starting anacron messages) --- anacron-2.3-hourly.patch | 40 ++++++++++++++++++++++++++++++++++++++++ anacron-2.3-log.patch | 25 +++++++++++++++++++++++++ anacron-script.patch | 12 ------------ anacron.init | 9 +++++---- anacron.spec | 37 +++++++++++++++++++------------------ 5 files changed, 89 insertions(+), 34 deletions(-) create mode 100644 anacron-2.3-hourly.patch create mode 100644 anacron-2.3-log.patch delete mode 100644 anacron-script.patch diff --git a/anacron-2.3-hourly.patch b/anacron-2.3-hourly.patch new file mode 100644 index 0000000..18a1120 --- /dev/null +++ b/anacron-2.3-hourly.patch @@ -0,0 +1,40 @@ +diff -up anacron-2.3/fedora/~anacron.old anacron-2.3/fedora/~anacron +--- anacron-2.3/fedora/~anacron.old 2008-05-28 13:06:21.000000000 +0200 ++++ anacron-2.3/fedora/~anacron 2008-05-22 14:40:49.000000000 +0200 +@@ -0,0 +1,36 @@ ++#!/bin/bash ++# cron.daily scripts aren't running, when hibernate is used. So let's solve it here. ++ ++# wait for 3:02 when /etc/crontab runs cron.daily ++if [ `date +%H` -le 4 ]; then ++ exit 0; ++fi ++ ++#delay ++[ -f /etc/sysconfig/crontab ] && . /etc/sysconfig/crontab ++if [ ! -z "$DELAY" ]; then ++ if [ "$DELAY" != "0" ]; then ++ # Create md5sum of hostname (static over system lifetime) ++ md5sum="`echo ${HOSTNAME} | md5sum`" ++ ++ # Extract the first 3 hexdigits (12 Bit: 0-4095) ++ hexvalue="${md5sum:0:3}" ++ ++ # Create decimal value ++ decvalue="`printf "%d" "0x${hexvalue}"`" ++ ++ # Divide delay by factor ++ T_DELAY=$[ ${decvalue} / ${DELAY} ] ++ sleep $T_DELAY ++ fi ++fi ++# in case anacron is already running, ++# there will be log (daemon won't be running twice). ++if test -x /usr/bin/on_ac_power; then ++ /usr/bin/on_ac_power &> /dev/null ++ if test $? -eq 1; then ++ exit 0 ++ fi ++fi ++/usr/sbin/anacron -s ++ diff --git a/anacron-2.3-log.patch b/anacron-2.3-log.patch new file mode 100644 index 0000000..4e5e408 --- /dev/null +++ b/anacron-2.3-log.patch @@ -0,0 +1,25 @@ +diff -up anacron-2.3/main.c.log anacron-2.3/main.c +--- anacron-2.3/main.c.log 2008-05-28 13:09:52.000000000 +0200 ++++ anacron-2.3/main.c 2008-05-28 13:24:17.000000000 +0200 +@@ -363,9 +363,11 @@ record_start_time() + day_of_month = tm_now->tm_mday; + day_now = day_num(year, month, day_of_month); + if (day_now == -1) die("Invalid date (this is really embarrassing)"); +- if (!update_only && !testing_only) ++/* if we use crontabs for running anacron -> this is not needed */ ++/* if (!update_only && !testing_only) + explain("Anacron " RELEASE " started on %04d-%02d-%02d", + year, month, day_of_month); ++*/ + } + + static int +@@ -491,6 +493,7 @@ main(int argc, char *argv[]) + launch_job(job_array[j]); + } + wait_children(); +- explain("Normal exit (%d job%s run)", njobs, (njobs == 1 ? "" : "s")); ++ if (njobs != 0) ++ explain("Normal exit (%d job%s run)", njobs, (njobs == 1 ? "" : "s")); + exit(0); + } diff --git a/anacron-script.patch b/anacron-script.patch deleted file mode 100644 index 69f78c2..0000000 --- a/anacron-script.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- anacron-2.3/debian/0anacron.daily.script 2007-08-15 09:21:14.000000000 +0200 -+++ anacron-2.3/debian/0anacron.daily 2007-08-15 09:30:15.000000000 +0200 -@@ -9,4 +9,8 @@ - # _before_ all other scripts. - - test -x /usr/sbin/anacron || exit 0 --anacron -u cron.daily -+AUX1=`cat /var/spool/anacron/cron.daily` -+AUX2=`date +%Y%m%d` -+if [ "$AUX1" != $AUX2 ]; then -+ anacron -u cron.daily -+fi diff --git a/anacron.init b/anacron.init index 4ab7fdc..90a0e0f 100755 --- a/anacron.init +++ b/anacron.init @@ -8,10 +8,8 @@ # Source function library. . /etc/rc.d/init.d/functions -[ -f /usr/sbin/anacron ] || exit 0 - prog="anacron" -PIDFILE=/var/spool/anacron/cron.daily +PIDFILE=/var/run/anacron.pid LOCKFILE=/var/lock/subsys/$prog # # NOTE: anacron exits after it has determined it has no more work to do. @@ -22,6 +20,7 @@ LOCKFILE=/var/lock/subsys/$prog # start() { + [ -x /usr/sbin/anacron ] || exit 5 echo -n $"Starting $prog: " daemon +19 anacron -s RETVAL=$? @@ -55,7 +54,8 @@ case "$1" in ;; status) - ## hard to say - anacron is up only when cron wake him + ## hard to say - anacron is up only when cron wake him + ## and has some jobs to do. status $prog RETVAL=$? ;; @@ -80,3 +80,4 @@ case "$1" in esac exit $RETVAL + diff --git a/anacron.spec b/anacron.spec index 6107289..45e1d56 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 60%{?dist} +Release: 61%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -13,9 +13,9 @@ Patch1: anacron-2.3-mail-content-type-77108.patch Patch2: anacron-2.3-fdclose.patch Patch3: anacron-2.3-pic.patch Patch4: anacron-2.3-memleaking.patch -Patch5: anacron-2.3-onbattery.patch -Patch6: anacron-2.3-sterr_null.patch -Patch7: anacron-2.3-spooldir.patch +Patch5: anacron-2.3-spooldir.patch +Patch6: anacron-2.3-hourly.patch +Patch7: anacron-2.3-log.patch Requires: crontabs Requires: initscripts @@ -33,12 +33,12 @@ therefore be used to control the execution of daily, weekly and monthly jobs (or anything with a period of n days), on systems that don't run 24 hours a day. When installed and configured properly, Anacron will make sure that the commands are run at the specified -intervals as closely as machine-uptime permits. +intervals as closely as machine-uptime permits. This package is pre-configured to execute the daily jobs of the Red -Hat Linux (or Fedora) system. You should install this program if your -system isn't powered on 24 hours a day to make sure the maintenance -jobs of other Red Hat Linux (or Fedora) packages are executed each day. +Hat Linux (or Fedora) system. It's part of triple - cronie, anacron +and crontabs, which care about execution of jobs also with often +reboots or hibernation. %prep %setup -q @@ -47,9 +47,9 @@ jobs of other Red Hat Linux (or Fedora) packages are executed each day. %patch2 -p1 -b .fdclose %patch3 -p1 -b .pic %patch4 -p1 -b .memleaking -%patch5 -p1 -b .onbattery -%patch6 -p1 -b .sterr -%patch7 -p1 -b .spool +%patch5 -p1 -b .spool +%patch6 -p1 +%patch7 -p1 -b .log %build make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} @@ -64,13 +64,11 @@ cp anacron.8 $RPM_BUILD_ROOT/%{_mandir}/man8/ cp anacrontab.5 $RPM_BUILD_ROOT/%{_mandir}/man5/ cp %SOURCE1 $RPM_BUILD_ROOT/etc -for i in cron.daily cron.weekly cron.monthly;do +for i in cron.daily cron.weekly cron.monthly cron.hourly;do mkdir -p $RPM_BUILD_ROOT/etc/$i/ done -cp debian/0anacron.daily $RPM_BUILD_ROOT/etc/cron.daily/0anacron -cp debian/0anacron.monthly $RPM_BUILD_ROOT/etc/cron.monthly/0anacron -cp debian/0anacron.weekly $RPM_BUILD_ROOT/etc/cron.weekly/0anacron +cp fedora/~anacron $RPM_BUILD_ROOT/etc/cron.hourly/~anacron mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/ install -c -m755 %SOURCE2 $RPM_BUILD_ROOT/etc/rc.d/init.d/anacron @@ -104,11 +102,14 @@ fi /%{_mandir}/man5/* /%{_mandir}/man8/* /usr/sbin/anacron -%attr(755,root,root) %dir /etc/cron.daily/0anacron -%attr(755,root,root) %dir /etc/cron.monthly/0anacron -%attr(755,root,root) %dir /etc/cron.weekly/0anacron +%attr(755,root,root) %dir /etc/cron.hourly/~anacron %changelog +* Wed May 28 2008 Marcela Maslanova 2.3-61 +- cleaning lots of scripts in anacron & crontabs should lead to + functional cron jobs (even with often shut down, hibernation) +- change log output (too many starting anacron messages) + * Wed Apr 9 2008 Marcela Maslanova 2.3-60 - correct spooldir logged From f770fe7452bbb73cf0a988684daf2bb5af04e212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Fri, 30 May 2008 12:45:31 +0000 Subject: [PATCH 03/31] - cleaning lots of scripts in anacron & crontabs --- anacron-2.3-hourly.patch | 13 +++++-------- anacron-2.3-log.patch | 25 ------------------------- anacron.spec | 18 +++++++++++------- 3 files changed, 16 insertions(+), 40 deletions(-) delete mode 100644 anacron-2.3-log.patch diff --git a/anacron-2.3-hourly.patch b/anacron-2.3-hourly.patch index 18a1120..e28ded5 100644 --- a/anacron-2.3-hourly.patch +++ b/anacron-2.3-hourly.patch @@ -1,16 +1,14 @@ -diff -up anacron-2.3/fedora/~anacron.old anacron-2.3/fedora/~anacron ---- anacron-2.3/fedora/~anacron.old 2008-05-28 13:06:21.000000000 +0200 -+++ anacron-2.3/fedora/~anacron 2008-05-22 14:40:49.000000000 +0200 -@@ -0,0 +1,36 @@ +diff -up anacron-2.3/fedora/anacron.daily.old anacron-2.3/fedora/anacron.daily +--- anacron-2.3/fedora/anacron.daily.old 2008-05-30 14:02:27.000000000 +0200 ++++ anacron-2.3/fedora/anacron.daily 2008-05-30 13:59:13.000000000 +0200 +@@ -0,0 +1,33 @@ +#!/bin/bash -+# cron.daily scripts aren't running, when hibernate is used. So let's solve it here. -+ +# wait for 3:02 when /etc/crontab runs cron.daily +if [ `date +%H` -le 4 ]; then + exit 0; +fi + -+#delay ++#delay - more computers on one line don't receive updates at the same time +[ -f /etc/sysconfig/crontab ] && . /etc/sysconfig/crontab +if [ ! -z "$DELAY" ]; then + if [ "$DELAY" != "0" ]; then @@ -37,4 +35,3 @@ diff -up anacron-2.3/fedora/~anacron.old anacron-2.3/fedora/~anacron + fi +fi +/usr/sbin/anacron -s -+ diff --git a/anacron-2.3-log.patch b/anacron-2.3-log.patch deleted file mode 100644 index 4e5e408..0000000 --- a/anacron-2.3-log.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -up anacron-2.3/main.c.log anacron-2.3/main.c ---- anacron-2.3/main.c.log 2008-05-28 13:09:52.000000000 +0200 -+++ anacron-2.3/main.c 2008-05-28 13:24:17.000000000 +0200 -@@ -363,9 +363,11 @@ record_start_time() - day_of_month = tm_now->tm_mday; - day_now = day_num(year, month, day_of_month); - if (day_now == -1) die("Invalid date (this is really embarrassing)"); -- if (!update_only && !testing_only) -+/* if we use crontabs for running anacron -> this is not needed */ -+/* if (!update_only && !testing_only) - explain("Anacron " RELEASE " started on %04d-%02d-%02d", - year, month, day_of_month); -+*/ - } - - static int -@@ -491,6 +493,7 @@ main(int argc, char *argv[]) - launch_job(job_array[j]); - } - wait_children(); -- explain("Normal exit (%d job%s run)", njobs, (njobs == 1 ? "" : "s")); -+ if (njobs != 0) -+ explain("Normal exit (%d job%s run)", njobs, (njobs == 1 ? "" : "s")); - exit(0); - } diff --git a/anacron.spec b/anacron.spec index 45e1d56..7c140f6 100644 --- a/anacron.spec +++ b/anacron.spec @@ -15,7 +15,6 @@ Patch3: anacron-2.3-pic.patch Patch4: anacron-2.3-memleaking.patch Patch5: anacron-2.3-spooldir.patch Patch6: anacron-2.3-hourly.patch -Patch7: anacron-2.3-log.patch Requires: crontabs Requires: initscripts @@ -49,7 +48,6 @@ reboots or hibernation. %patch4 -p1 -b .memleaking %patch5 -p1 -b .spool %patch6 -p1 -%patch7 -p1 -b .log %build make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} @@ -68,7 +66,9 @@ for i in cron.daily cron.weekly cron.monthly cron.hourly;do mkdir -p $RPM_BUILD_ROOT/etc/$i/ done -cp fedora/~anacron $RPM_BUILD_ROOT/etc/cron.hourly/~anacron +install -m755 fedora/anacron.daily $RPM_BUILD_ROOT/etc/cron.daily/0anacron +ln -s ../cron.daily/0anacron $RPM_BUILD_ROOT/etc/cron.weekly/0anacron +ln -s ../cron.daily/0anacron $RPM_BUILD_ROOT/etc/cron.monthly/0anacron mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/ install -c -m755 %SOURCE2 $RPM_BUILD_ROOT/etc/rc.d/init.d/anacron @@ -102,13 +102,17 @@ fi /%{_mandir}/man5/* /%{_mandir}/man8/* /usr/sbin/anacron -%attr(755,root,root) %dir /etc/cron.hourly/~anacron +%dir /etc/cron.hourly +%dir /etc/cron.daily +%dir /etc/cron.weekly +%dir /etc/cron.monthly +%dir /etc/cron.daily/0anacron +%dir /etc/cron.weekly/0anacron +%dir /etc/cron.monthly/0anacron %changelog * Wed May 28 2008 Marcela Maslanova 2.3-61 -- cleaning lots of scripts in anacron & crontabs should lead to - functional cron jobs (even with often shut down, hibernation) -- change log output (too many starting anacron messages) +- cleaning lots of scripts in anacron & crontabs * Wed Apr 9 2008 Marcela Maslanova 2.3-60 - correct spooldir logged From 7d3cf7fb69acdbcd24d0210523576c76d931217f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Wed, 30 Jul 2008 14:09:55 +0000 Subject: [PATCH 04/31] - 441576 really stop anacron daemon --- anacron.init | 20 +++++++++++--------- anacron.spec | 5 ++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/anacron.init b/anacron.init index 90a0e0f..03dba1d 100755 --- a/anacron.init +++ b/anacron.init @@ -11,6 +11,8 @@ prog="anacron" PIDFILE=/var/run/anacron.pid LOCKFILE=/var/lock/subsys/$prog +ANACRON=/usr/sbin/anacron + # # NOTE: anacron exits after it has determined it has no more work to do. # Hence, its initscript cannot do normal lock file management. @@ -20,7 +22,7 @@ LOCKFILE=/var/lock/subsys/$prog # start() { - [ -x /usr/sbin/anacron ] || exit 5 + [ -x $ANACRON ] || exit 5 echo -n $"Starting $prog: " daemon +19 anacron -s RETVAL=$? @@ -32,15 +34,15 @@ start() { stop() { echo -n $"Stopping $prog: " - if [ -f $PIDFILE ]; then - killproc anacron - RETVAL=$? - if [ $RETVAL -ne 0 ]; then - failure; - fi; - else - failure; + # daemon exists only sometime -> hard to kill + killproc $ANACRON + RETVAL=3 + # kill first, than ask + if [ -n "`pidfileofproc $ANACRON`" ]; then + failure $"Stopping $prog" + RETVAL=1 fi + [ "RETVAL" = 0 ] && rm -f $LOCK_FILE echo } diff --git a/anacron.spec b/anacron.spec index 7c140f6..c0e7636 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 61%{?dist} +Release: 62%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -111,6 +111,9 @@ fi %dir /etc/cron.monthly/0anacron %changelog +* Wed Jul 30 2008 Marcela Maslanova 2.3-62 +- 441576 really stop anacron daemon + * Wed May 28 2008 Marcela Maslanova 2.3-61 - cleaning lots of scripts in anacron & crontabs From e7fd054254cf6de62ddf0d64c6ca00dd6695c41a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Mon, 22 Sep 2008 16:07:05 +0000 Subject: [PATCH 05/31] - 441576 really stop anacron daemon --- anacron.init | 1 + 1 file changed, 1 insertion(+) diff --git a/anacron.init b/anacron.init index 03dba1d..6a3db1e 100755 --- a/anacron.init +++ b/anacron.init @@ -29,6 +29,7 @@ start() { if [ $RETVAL -ne 0 ]; then failure; fi; + [ "$RETVAL" = 0 ] && touch $LOCKFILE echo } From c9e1ba6ac9cecc32040199aa7a730dd6cd68ca7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Mon, 22 Sep 2008 16:08:47 +0000 Subject: [PATCH 06/31] - correct init script - really kill anacron --- anacron.init | 2 ++ anacron.spec | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/anacron.init b/anacron.init index 4ab7fdc..c797709 100755 --- a/anacron.init +++ b/anacron.init @@ -28,6 +28,7 @@ start() { if [ $RETVAL -ne 0 ]; then failure; fi; + [ "$RETVAL" = 0 ] && touch $LOCKFILE echo } @@ -42,6 +43,7 @@ stop() { else failure; fi + [ "$RETVAL" = 0 ] && touch $LOCKFILE echo } diff --git a/anacron.spec b/anacron.spec index 6107289..060e8f5 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 60%{?dist} +Release: 61%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -109,6 +109,9 @@ fi %attr(755,root,root) %dir /etc/cron.weekly/0anacron %changelog +* Mon Sep 22 2008 Marcela Maslanova 2.3-61 +- correct init script - really kill anacron + * Wed Apr 9 2008 Marcela Maslanova 2.3-60 - correct spooldir logged From f18e3e8e83fd822cad87c9908eeb77af73a5b70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Mon, 22 Sep 2008 16:12:15 +0000 Subject: [PATCH 07/31] - fix previous patch, thanks to mbroz --- anacron.init | 30 ++++++++++++++---------------- anacron.spec | 5 ++++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/anacron.init b/anacron.init index 6a3db1e..c797709 100755 --- a/anacron.init +++ b/anacron.init @@ -8,11 +8,11 @@ # Source function library. . /etc/rc.d/init.d/functions -prog="anacron" -PIDFILE=/var/run/anacron.pid -LOCKFILE=/var/lock/subsys/$prog -ANACRON=/usr/sbin/anacron +[ -f /usr/sbin/anacron ] || exit 0 +prog="anacron" +PIDFILE=/var/spool/anacron/cron.daily +LOCKFILE=/var/lock/subsys/$prog # # NOTE: anacron exits after it has determined it has no more work to do. # Hence, its initscript cannot do normal lock file management. @@ -22,7 +22,6 @@ ANACRON=/usr/sbin/anacron # start() { - [ -x $ANACRON ] || exit 5 echo -n $"Starting $prog: " daemon +19 anacron -s RETVAL=$? @@ -35,15 +34,16 @@ start() { stop() { echo -n $"Stopping $prog: " - # daemon exists only sometime -> hard to kill - killproc $ANACRON - RETVAL=3 - # kill first, than ask - if [ -n "`pidfileofproc $ANACRON`" ]; then - failure $"Stopping $prog" - RETVAL=1 + if [ -f $PIDFILE ]; then + killproc anacron + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + failure; + fi; + else + failure; fi - [ "RETVAL" = 0 ] && rm -f $LOCK_FILE + [ "$RETVAL" = 0 ] && touch $LOCKFILE echo } @@ -57,8 +57,7 @@ case "$1" in ;; status) - ## hard to say - anacron is up only when cron wake him - ## and has some jobs to do. + ## hard to say - anacron is up only when cron wake him status $prog RETVAL=$? ;; @@ -83,4 +82,3 @@ case "$1" in esac exit $RETVAL - diff --git a/anacron.spec b/anacron.spec index c0e7636..a61b40c 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 62%{?dist} +Release: 63%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -111,6 +111,9 @@ fi %dir /etc/cron.monthly/0anacron %changelog +* Wed Jul 30 2008 Marcela Maslanova 2.3-63 +- fix previous patch, thanks to mbroz + * Wed Jul 30 2008 Marcela Maslanova 2.3-62 - 441576 really stop anacron daemon From 5c8d131bb729211d363e789c0dbcea58db809143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Tue, 23 Sep 2008 06:47:39 +0000 Subject: [PATCH 08/31] Fix fuzz. --- anacron.spec | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/anacron.spec b/anacron.spec index a61b40c..98fe063 100644 --- a/anacron.spec +++ b/anacron.spec @@ -8,13 +8,13 @@ URL: http://packages.debian.org/stable/source/anacron Source: http://ftp.debian.org/debian/pool/main/a/anacron/%{name}_%{version}.orig.tar.gz Source1: anacrontab Source2: anacron.init -Patch0: anacron_2.3-13.patch -Patch1: anacron-2.3-mail-content-type-77108.patch -Patch2: anacron-2.3-fdclose.patch -Patch3: anacron-2.3-pic.patch -Patch4: anacron-2.3-memleaking.patch -Patch5: anacron-2.3-spooldir.patch -Patch6: anacron-2.3-hourly.patch +Patch1: anacron_2.3-13.patch +Patch2: anacron-2.3-mail-content-type-77108.patch +Patch3: anacron-2.3-fdclose.patch +Patch4: anacron-2.3-pic.patch +Patch5: anacron-2.3-memleaking.patch +Patch6: anacron-2.3-spooldir.patch +Patch7: anacron-2.3-hourly.patch Requires: crontabs Requires: initscripts @@ -41,13 +41,13 @@ reboots or hibernation. %prep %setup -q -%patch0 -p1 -b .try -%patch1 -p1 -b .charset -%patch2 -p1 -b .fdclose -%patch3 -p1 -b .pic -%patch4 -p1 -b .memleaking -%patch5 -p1 -b .spool -%patch6 -p1 +%patch1 -p1 -b .try +%patch2 -p1 -b .charset +%patch3 -p1 -b .fdclose +%patch4 -p1 -b .pic +%patch5 -p1 -b .memleaking +%patch6 -p1 -b .spool +%patch7 -p1 %build make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} From cee41ed7e1cba1529af9125dd4ec34d16bec5500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Tue, 23 Sep 2008 08:23:14 +0000 Subject: [PATCH 09/31] Fix fuzz problem, remove unused patches. --- anacron-2.3-fdclose.patch | 26 +++++----- anacron-2.3-mail-content-type-77108.patch | 14 +++--- anacron-2.3-onbattery.patch | 60 ----------------------- anacron-2.3-sterr_null.patch | 36 -------------- anacron.init | 35 +++++++------ 5 files changed, 37 insertions(+), 134 deletions(-) delete mode 100644 anacron-2.3-onbattery.patch delete mode 100644 anacron-2.3-sterr_null.patch diff --git a/anacron-2.3-fdclose.patch b/anacron-2.3-fdclose.patch index 96e20d4..4ee0bc9 100644 --- a/anacron-2.3-fdclose.patch +++ b/anacron-2.3-fdclose.patch @@ -1,7 +1,7 @@ -diff -uNr anacron-2.3-orig/global.h anacron-2.3/global.h ---- anacron-2.3-orig/global.h 2000-06-23 01:00:14.000000000 +0100 -+++ anacron-2.3/global.h 2006-03-20 15:31:28.000000000 +0000 -@@ -60,6 +60,7 @@ +diff -up anacron-2.3/global.h.fdclose anacron-2.3/global.h +--- anacron-2.3/global.h.fdclose 2008-09-23 10:06:04.000000000 +0200 ++++ anacron-2.3/global.h 2008-09-23 10:06:04.000000000 +0200 +@@ -63,6 +63,7 @@ struct job_rec1 { int tab_line; int arg_num; int timestamp_fd; @@ -9,9 +9,9 @@ diff -uNr anacron-2.3-orig/global.h anacron-2.3/global.h int output_fd; int mail_header_size; pid_t job_pid; -diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c ---- anacron-2.3-orig/runjob.c 2006-02-21 14:05:08.000000000 +0000 -+++ anacron-2.3/runjob.c 2006-03-20 15:32:32.000000000 +0000 +diff -up anacron-2.3/runjob.c.fdclose anacron-2.3/runjob.c +--- anacron-2.3/runjob.c.fdclose 2008-09-23 10:06:04.000000000 +0200 ++++ anacron-2.3/runjob.c 2008-09-23 10:06:04.000000000 +0200 @@ -38,12 +38,12 @@ #include @@ -27,7 +27,7 @@ diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c i = 0; name = NULL; -@@ -53,16 +53,24 @@ +@@ -53,16 +53,24 @@ temp_file() free(name); name = tempnam(NULL, NULL); if (name == NULL) die("Can't find a unique temporary filename"); @@ -58,7 +58,7 @@ diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c } static off_t -@@ -170,17 +178,28 @@ +@@ -167,17 +175,28 @@ launch_mailer(job_rec *jr) pid = xfork(); if (pid == 0) { @@ -88,16 +88,16 @@ diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c /* Here, I basically mirrored the way /usr/sbin/sendmail is called * by cron on a Debian system, except for the "-oem" and "-or0s" * options, which don't seem to be appropriate here. -@@ -225,7 +244,7 @@ - setup_env(jr); +@@ -236,7 +255,7 @@ launch_job(job_rec *jr) + jr->mailto = username (); /* create temporary file for stdout and stderr of the job */ - fd = jr->output_fd = temp_file(); + temp_file(jr); fd = jr->output_fd; /* write mail header */ xwrite(fd, "From: "); - xwrite(fd, username()); -@@ -283,6 +302,7 @@ + xwrite(fd, "Anacron <"); +@@ -302,6 +321,7 @@ tend_job(job_rec *jr, int status) running_jobs--; if (mail_output) launch_mailer(jr); xclose(jr->output_fd); diff --git a/anacron-2.3-mail-content-type-77108.patch b/anacron-2.3-mail-content-type-77108.patch index 4481603..b5d0a39 100644 --- a/anacron-2.3-mail-content-type-77108.patch +++ b/anacron-2.3-mail-content-type-77108.patch @@ -1,6 +1,6 @@ -diff -u anacron-2.3/runjob.c~ anacron-2.3/runjob.c ---- anacron-2.3/runjob.c~ 2003-07-10 15:25:44.000000000 +0900 -+++ anacron-2.3/runjob.c 2003-07-10 15:25:44.000000000 +0900 +diff -up anacron-2.3/runjob.c.charset anacron-2.3/runjob.c +--- anacron-2.3/runjob.c.charset 2008-09-23 09:42:49.000000000 +0200 ++++ anacron-2.3/runjob.c 2008-09-23 09:42:49.000000000 +0200 @@ -35,6 +35,8 @@ #include #include "global.h" @@ -10,13 +10,13 @@ diff -u anacron-2.3/runjob.c~ anacron-2.3/runjob.c static int temp_file() /* Open a temporary file and return its file descriptor */ -@@ -217,6 +219,9 @@ - xwrite(fd, "To: "); - xwrite(fd, username()); +@@ -247,6 +249,9 @@ launch_job(job_rec *jr) + xwrite(fd, username()); + } xwrite(fd, "\n"); + xwrite(fd, "Content-Type: text/plain; charset=\""); + xwrite(fd, nl_langinfo(CODESET)); + xwrite(fd, "\"\n"); xwrite(fd, "Subject: Anacron job '"); xwrite(fd, jr->ident); - xwrite(fd, "'\n\n"); + xwrite(fd, "' on "); diff --git a/anacron-2.3-onbattery.patch b/anacron-2.3-onbattery.patch deleted file mode 100644 index 7e9943d..0000000 --- a/anacron-2.3-onbattery.patch +++ /dev/null @@ -1,60 +0,0 @@ -diff -up anacron-2.3/debian/0anacron.daily.old anacron-2.3/debian/0anacron.daily ---- anacron-2.3/debian/0anacron.daily.old 2007-11-30 13:35:58.000000000 +0100 -+++ anacron-2.3/debian/0anacron.daily 2007-12-10 12:42:04.000000000 +0100 -@@ -8,5 +8,16 @@ - # The script is called "0anacron" to assure that it will be executed - # _before_ all other scripts. - -+# on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) -+if test -x /usr/bin/on_ac_power -+ then -+ /usr/bin/on_ac_power > /dev/null -+ if test $? -eq 1 -+ then -+ echo "deferred while on battery power." -+ exit 0 -+ fi -+fi -+ - test -x /usr/sbin/anacron || exit 0 - anacron -u cron.daily -diff -up anacron-2.3/debian/0anacron.weekly.old anacron-2.3/debian/0anacron.weekly ---- anacron-2.3/debian/0anacron.weekly.old 2007-12-10 12:42:53.000000000 +0100 -+++ anacron-2.3/debian/0anacron.weekly 2007-12-10 12:43:26.000000000 +0100 -@@ -8,5 +8,16 @@ - # The script is called "0anacron" to assure that it will be executed - # _before_ all other scripts. - -+# on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) -+if test -x /usr/bin/on_ac_power -+ then -+ /usr/bin/on_ac_power > /dev/null -+ if test $? -eq 1 -+ then -+ echo "deferred while on battery power." -+ exit 0 -+ fi -+fi -+ - test -x /usr/sbin/anacron || exit 0 - anacron -u cron.weekly -diff -up anacron-2.3/debian/0anacron.monthly.old anacron-2.3/debian/0anacron.monthly ---- anacron-2.3/debian/0anacron.monthly.old 2007-12-10 12:42:42.000000000 +0100 -+++ anacron-2.3/debian/0anacron.monthly 2007-12-10 12:43:12.000000000 +0100 -@@ -8,5 +8,16 @@ - # The script is called "0anacron" to assure that it will be executed - # _before_ all other scripts. - -+# on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) -+if test -x /usr/bin/on_ac_power -+ then -+ /usr/bin/on_ac_power > /dev/null -+ if test $? -eq 1 -+ then -+ echo "deferred while on battery power." -+ exit 0 -+ fi -+fi -+ - test -x /usr/sbin/anacron || exit 0 - anacron -u cron.monthly diff --git a/anacron-2.3-sterr_null.patch b/anacron-2.3-sterr_null.patch deleted file mode 100644 index c9b9ad5..0000000 --- a/anacron-2.3-sterr_null.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -up anacron-2.3/debian/0anacron.monthly.err anacron-2.3/debian/0anacron.monthly ---- anacron-2.3/debian/0anacron.monthly.err 2007-12-11 09:07:12.000000000 +0100 -+++ anacron-2.3/debian/0anacron.monthly 2008-02-28 14:05:55.000000000 +0100 -@@ -11,7 +11,7 @@ - # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) - if test -x /usr/bin/on_ac_power - then -- /usr/bin/on_ac_power > /dev/null -+ /usr/bin/on_ac_power &> /dev/null - if test $? -eq 1 - then - echo "deferred while on battery power." -diff -up anacron-2.3/debian/0anacron.weekly.err anacron-2.3/debian/0anacron.weekly ---- anacron-2.3/debian/0anacron.weekly.err 2007-12-11 09:07:12.000000000 +0100 -+++ anacron-2.3/debian/0anacron.weekly 2008-02-28 14:06:03.000000000 +0100 -@@ -11,7 +11,7 @@ - # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) - if test -x /usr/bin/on_ac_power - then -- /usr/bin/on_ac_power > /dev/null -+ /usr/bin/on_ac_power &> /dev/null - if test $? -eq 1 - then - echo "deferred while on battery power." -diff -up anacron-2.3/debian/0anacron.daily.err anacron-2.3/debian/0anacron.daily ---- anacron-2.3/debian/0anacron.daily.err 2007-12-11 09:07:12.000000000 +0100 -+++ anacron-2.3/debian/0anacron.daily 2008-02-28 14:05:48.000000000 +0100 -@@ -11,7 +11,7 @@ - # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) - if test -x /usr/bin/on_ac_power - then -- /usr/bin/on_ac_power > /dev/null -+ /usr/bin/on_ac_power &> /dev/null - if test $? -eq 1 - then - echo "deferred while on battery power." diff --git a/anacron.init b/anacron.init index c797709..4d20e76 100755 --- a/anacron.init +++ b/anacron.init @@ -1,7 +1,7 @@ #!/bin/sh # Startup script for anacron # -# chkconfig: 2345 99 05 +# chkconfig: 2345 95 05 # description: Run cron jobs that were left out due to downtime # pidfile: /var/run/anacron.pid # @@ -11,14 +11,15 @@ [ -f /usr/sbin/anacron ] || exit 0 prog="anacron" -PIDFILE=/var/spool/anacron/cron.daily +PIDFILE=/var/run/${prog}.pid LOCKFILE=/var/lock/subsys/$prog # # NOTE: anacron exits after it has determined it has no more work to do. # Hence, its initscript cannot do normal lock file management. -# The anacron binary now creates its own timestamps in files -# /var/spool/anacron/cron.{daily,monthly,weekly} -# and /var/lock/subsys lock files. +# The anacron binary now creates its own /var/run/anacron.pid pid file +# and /var/lock/subsys lock files, and removes them automatically at exit, +# so at least there will be no more "anacron is dead but subsys locked" +# messages. # start() { @@ -28,8 +29,8 @@ start() { if [ $RETVAL -ne 0 ]; then failure; fi; - [ "$RETVAL" = 0 ] && touch $LOCKFILE echo + return $RETVAL } stop() { @@ -41,10 +42,11 @@ stop() { failure; fi; else + RETVAL=1 failure; fi - [ "$RETVAL" = 0 ] && touch $LOCKFILE echo + return $RETVAL } case "$1" in @@ -57,9 +59,7 @@ case "$1" in ;; status) - ## hard to say - anacron is up only when cron wake him - status $prog - RETVAL=$? + status anacron ;; restart) @@ -68,16 +68,15 @@ case "$1" in ;; condrestart) - if [ -f /var/lock/subsys/anacron ]; then - stop - sleep 2 - start - fi - ;; - + if [ -f $LOCKFILE ]; then + stop + start + fi + ;; + *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" - RETVAL=3 + exit 1 esac From 776f818eb0c55331e7015e7cad1d5c2f433d915e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Tue, 23 Sep 2008 08:27:10 +0000 Subject: [PATCH 10/31] - fix fuzz - fix previous patch, thanks to mbroz --- anacron.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/anacron.spec b/anacron.spec index 98fe063..3dd228f 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 63%{?dist} +Release: 64%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -111,7 +111,8 @@ fi %dir /etc/cron.monthly/0anacron %changelog -* Wed Jul 30 2008 Marcela Maslanova 2.3-63 +* Wed Jul 30 2008 Marcela Maslanova 2.3-64 +- fix fuzz - fix previous patch, thanks to mbroz * Wed Jul 30 2008 Marcela Maslanova 2.3-62 From 08a5d1b934344add3de02f721f999f530ec1a510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Thu, 23 Oct 2008 13:47:16 +0000 Subject: [PATCH 11/31] - rewrite init script - using fedora guidelines SysVInitScript --- anacron-2.3-fdclose.patch | 26 ++-- anacron-2.3-mail-content-type-77108.patch | 14 +-- anacron.init | 141 ++++++++++++---------- anacron.spec | 7 +- 4 files changed, 103 insertions(+), 85 deletions(-) diff --git a/anacron-2.3-fdclose.patch b/anacron-2.3-fdclose.patch index 96e20d4..4ee0bc9 100644 --- a/anacron-2.3-fdclose.patch +++ b/anacron-2.3-fdclose.patch @@ -1,7 +1,7 @@ -diff -uNr anacron-2.3-orig/global.h anacron-2.3/global.h ---- anacron-2.3-orig/global.h 2000-06-23 01:00:14.000000000 +0100 -+++ anacron-2.3/global.h 2006-03-20 15:31:28.000000000 +0000 -@@ -60,6 +60,7 @@ +diff -up anacron-2.3/global.h.fdclose anacron-2.3/global.h +--- anacron-2.3/global.h.fdclose 2008-09-23 10:06:04.000000000 +0200 ++++ anacron-2.3/global.h 2008-09-23 10:06:04.000000000 +0200 +@@ -63,6 +63,7 @@ struct job_rec1 { int tab_line; int arg_num; int timestamp_fd; @@ -9,9 +9,9 @@ diff -uNr anacron-2.3-orig/global.h anacron-2.3/global.h int output_fd; int mail_header_size; pid_t job_pid; -diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c ---- anacron-2.3-orig/runjob.c 2006-02-21 14:05:08.000000000 +0000 -+++ anacron-2.3/runjob.c 2006-03-20 15:32:32.000000000 +0000 +diff -up anacron-2.3/runjob.c.fdclose anacron-2.3/runjob.c +--- anacron-2.3/runjob.c.fdclose 2008-09-23 10:06:04.000000000 +0200 ++++ anacron-2.3/runjob.c 2008-09-23 10:06:04.000000000 +0200 @@ -38,12 +38,12 @@ #include @@ -27,7 +27,7 @@ diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c i = 0; name = NULL; -@@ -53,16 +53,24 @@ +@@ -53,16 +53,24 @@ temp_file() free(name); name = tempnam(NULL, NULL); if (name == NULL) die("Can't find a unique temporary filename"); @@ -58,7 +58,7 @@ diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c } static off_t -@@ -170,17 +178,28 @@ +@@ -167,17 +175,28 @@ launch_mailer(job_rec *jr) pid = xfork(); if (pid == 0) { @@ -88,16 +88,16 @@ diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c /* Here, I basically mirrored the way /usr/sbin/sendmail is called * by cron on a Debian system, except for the "-oem" and "-or0s" * options, which don't seem to be appropriate here. -@@ -225,7 +244,7 @@ - setup_env(jr); +@@ -236,7 +255,7 @@ launch_job(job_rec *jr) + jr->mailto = username (); /* create temporary file for stdout and stderr of the job */ - fd = jr->output_fd = temp_file(); + temp_file(jr); fd = jr->output_fd; /* write mail header */ xwrite(fd, "From: "); - xwrite(fd, username()); -@@ -283,6 +302,7 @@ + xwrite(fd, "Anacron <"); +@@ -302,6 +321,7 @@ tend_job(job_rec *jr, int status) running_jobs--; if (mail_output) launch_mailer(jr); xclose(jr->output_fd); diff --git a/anacron-2.3-mail-content-type-77108.patch b/anacron-2.3-mail-content-type-77108.patch index 4481603..b5d0a39 100644 --- a/anacron-2.3-mail-content-type-77108.patch +++ b/anacron-2.3-mail-content-type-77108.patch @@ -1,6 +1,6 @@ -diff -u anacron-2.3/runjob.c~ anacron-2.3/runjob.c ---- anacron-2.3/runjob.c~ 2003-07-10 15:25:44.000000000 +0900 -+++ anacron-2.3/runjob.c 2003-07-10 15:25:44.000000000 +0900 +diff -up anacron-2.3/runjob.c.charset anacron-2.3/runjob.c +--- anacron-2.3/runjob.c.charset 2008-09-23 09:42:49.000000000 +0200 ++++ anacron-2.3/runjob.c 2008-09-23 09:42:49.000000000 +0200 @@ -35,6 +35,8 @@ #include #include "global.h" @@ -10,13 +10,13 @@ diff -u anacron-2.3/runjob.c~ anacron-2.3/runjob.c static int temp_file() /* Open a temporary file and return its file descriptor */ -@@ -217,6 +219,9 @@ - xwrite(fd, "To: "); - xwrite(fd, username()); +@@ -247,6 +249,9 @@ launch_job(job_rec *jr) + xwrite(fd, username()); + } xwrite(fd, "\n"); + xwrite(fd, "Content-Type: text/plain; charset=\""); + xwrite(fd, nl_langinfo(CODESET)); + xwrite(fd, "\"\n"); xwrite(fd, "Subject: Anacron job '"); xwrite(fd, jr->ident); - xwrite(fd, "'\n\n"); + xwrite(fd, "' on "); diff --git a/anacron.init b/anacron.init index c797709..b62fe40 100755 --- a/anacron.init +++ b/anacron.init @@ -1,84 +1,99 @@ #!/bin/sh -# Startup script for anacron # -# chkconfig: 2345 99 05 -# description: Run cron jobs that were left out due to downtime -# pidfile: /var/run/anacron.pid +# anacron Run cron jobs that were left out due to downtime. # +# chkconfig: 2345 99 05 +# description: anacron exits after it has determined it has no more work to do. \ +# Hence, its initscript cannot do normal lock file management. \ +# The anacron binary now creates its own /var/run/anacron.pid pid file \ +# and /var/lock/subsys lock files, and removes them automatically at exit, \ +# so at least there will be no more "anacron is dead but subsys locked" \ +# messages. + +### BEGIN INIT INFO +# Provides: $anacron +# Required-Start: $local_fs $syslog +# Required-Stop: $local_fs $syslog +# Default-Start: 2345 +# Default-Stop: 99 +# Short-Description: run left over cron jobs +# Description: anacron exits after it has determined it has no more work to do. +# Hence, its initscript cannot do normal lock file management. +# The anacron binary now creates its own /var/run/anacron.pid pid file +# and /var/lock/subsys lock files, and removes them automatically at exit, +# so at least there will be no more "anacron is dead but subsys locked" +# messages. +### END INIT INFO + # Source function library. . /etc/rc.d/init.d/functions -[ -f /usr/sbin/anacron ] || exit 0 +exec=/usr/sbin/anacron +prog=anacron +#config=doesn't have config file, some values are stored in /etc/anacrontab -prog="anacron" -PIDFILE=/var/spool/anacron/cron.daily -LOCKFILE=/var/lock/subsys/$prog -# -# NOTE: anacron exits after it has determined it has no more work to do. -# Hence, its initscript cannot do normal lock file management. -# The anacron binary now creates its own timestamps in files -# /var/spool/anacron/cron.{daily,monthly,weekly} -# and /var/lock/subsys lock files. -# +lockfile=/var/lock/subsys/$prog start() { - echo -n $"Starting $prog: " + [ -x $exec ] || exit 5 + echo -n $"Starting $prog: " daemon +19 anacron -s - RETVAL=$? - if [ $RETVAL -ne 0 ]; then - failure; - fi; - [ "$RETVAL" = 0 ] && touch $LOCKFILE + retval=$? echo + [ $retval -eq 0 ] + ## && touch $lockfile it creates lock in code + return $retval } stop() { echo -n $"Stopping $prog: " - if [ -f $PIDFILE ]; then - killproc anacron - RETVAL=$? - if [ $RETVAL -ne 0 ]; then - failure; - fi; - else - failure; - fi - [ "$RETVAL" = 0 ] && touch $LOCKFILE + killproc $prog + retval=$? echo + [ $retval -eq 0 ] + #usually anacron clean his lock after he stops himself. + #Just in case something goes wrong kill him. + [ -f $lockfile ] && rm -f $lockfile + return $retval } +restart() { + stop + start +} + +rh_status() { + # run checks to determine if the service is running or use generic status + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + case "$1" in - start) - start - ;; - - stop) - stop - ;; - - status) - ## hard to say - anacron is up only when cron wake him - status $prog - RETVAL=$? - ;; - - restart) - stop - start - ;; - - condrestart) - if [ -f /var/lock/subsys/anacron ]; then - stop - sleep 2 - start - fi - ;; - - *) - echo $"Usage: $0 {start|stop|restart|condrestart|status}" - RETVAL=3 - + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + status) + rh_status + ;; + condrestart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart}" + exit 2 esac +exit $? -exit $RETVAL diff --git a/anacron.spec b/anacron.spec index 060e8f5..487854e 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 61%{?dist} +Release: 62%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -109,6 +109,9 @@ fi %attr(755,root,root) %dir /etc/cron.weekly/0anacron %changelog +* Thu Oct 23 2008 Marcela Mašláňová 2.3-62 +- rewrite init script - using fedora guidelines SysVInitScript + * Mon Sep 22 2008 Marcela Maslanova 2.3-61 - correct init script - really kill anacron @@ -117,7 +120,7 @@ fi * Thu Feb 28 2008 Marcela Maslanova 2.3-59 - 0anacron.{daily,weekly,monthly} sterror's output also goes to - dev/null +dev/null - rhbz#435255 * Tue Feb 19 2008 Fedora Release Engineering - 2.3-58 From 4e2effc666756e687d41af4aed116ec25c5f8f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Fri, 24 Oct 2008 13:02:50 +0000 Subject: [PATCH 12/31] - rewrite init script - using fedora guidelines SysVInitScript --- anacron.init | 140 ++++++++++++++++++++++++++++----------------------- anacron.spec | 5 +- 2 files changed, 82 insertions(+), 63 deletions(-) diff --git a/anacron.init b/anacron.init index 4d20e76..b62fe40 100755 --- a/anacron.init +++ b/anacron.init @@ -1,83 +1,99 @@ #!/bin/sh -# Startup script for anacron # -# chkconfig: 2345 95 05 -# description: Run cron jobs that were left out due to downtime -# pidfile: /var/run/anacron.pid +# anacron Run cron jobs that were left out due to downtime. # -# Source function library. -. /etc/rc.d/init.d/functions +# chkconfig: 2345 99 05 +# description: anacron exits after it has determined it has no more work to do. \ +# Hence, its initscript cannot do normal lock file management. \ +# The anacron binary now creates its own /var/run/anacron.pid pid file \ +# and /var/lock/subsys lock files, and removes them automatically at exit, \ +# so at least there will be no more "anacron is dead but subsys locked" \ +# messages. -[ -f /usr/sbin/anacron ] || exit 0 - -prog="anacron" -PIDFILE=/var/run/${prog}.pid -LOCKFILE=/var/lock/subsys/$prog -# -# NOTE: anacron exits after it has determined it has no more work to do. +### BEGIN INIT INFO +# Provides: $anacron +# Required-Start: $local_fs $syslog +# Required-Stop: $local_fs $syslog +# Default-Start: 2345 +# Default-Stop: 99 +# Short-Description: run left over cron jobs +# Description: anacron exits after it has determined it has no more work to do. # Hence, its initscript cannot do normal lock file management. # The anacron binary now creates its own /var/run/anacron.pid pid file # and /var/lock/subsys lock files, and removes them automatically at exit, -# so at least there will be no more "anacron is dead but subsys locked" -# messages. -# +# so at least there will be no more "anacron is dead but subsys locked" +# messages. +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +exec=/usr/sbin/anacron +prog=anacron +#config=doesn't have config file, some values are stored in /etc/anacrontab + +lockfile=/var/lock/subsys/$prog start() { - echo -n $"Starting $prog: " + [ -x $exec ] || exit 5 + echo -n $"Starting $prog: " daemon +19 anacron -s - RETVAL=$? - if [ $RETVAL -ne 0 ]; then - failure; - fi; + retval=$? echo - return $RETVAL + [ $retval -eq 0 ] + ## && touch $lockfile it creates lock in code + return $retval } stop() { echo -n $"Stopping $prog: " - if [ -f $PIDFILE ]; then - killproc anacron - RETVAL=$? - if [ $RETVAL -ne 0 ]; then - failure; - fi; - else - RETVAL=1 - failure; - fi + killproc $prog + retval=$? echo - return $RETVAL + [ $retval -eq 0 ] + #usually anacron clean his lock after he stops himself. + #Just in case something goes wrong kill him. + [ -f $lockfile ] && rm -f $lockfile + return $retval } +restart() { + stop + start +} + +rh_status() { + # run checks to determine if the service is running or use generic status + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + case "$1" in - start) - start - ;; - - stop) - stop - ;; - - status) - status anacron - ;; - - restart) - stop - start - ;; - - condrestart) - if [ -f $LOCKFILE ]; then - stop - start - fi - ;; - - *) - echo $"Usage: $0 {start|stop|restart|condrestart|status}" - exit 1 - + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + status) + rh_status + ;; + condrestart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart}" + exit 2 esac +exit $? -exit $RETVAL diff --git a/anacron.spec b/anacron.spec index 3dd228f..baf3855 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 64%{?dist} +Release: 65%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -111,6 +111,9 @@ fi %dir /etc/cron.monthly/0anacron %changelog +* Fri Oct 24 2008 Marcela Mašláňová 2.3-65 +- rewrite init script - using fedora guidelines SysVInitScript + * Wed Jul 30 2008 Marcela Maslanova 2.3-64 - fix fuzz - fix previous patch, thanks to mbroz From 026329cd1f1f048950c2fc93a3b9f222d598eee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Mon, 26 Jan 2009 09:25:53 +0000 Subject: [PATCH 13/31] - cron.{daily,weekly,hourly,monthly} should be owned by crontabs, because some don't have installed anacron and other cron like programmes could be dependent - 0anacron is now trying run all cron.{daily,weekly,...} every hour. This should fix problem with jobs running twice, with not running jobs after hibernation and so on. - the random delay is in default switch off --- .cvsignore | 1 + anacron.init | 151 ++++++++++++++++++++++++--------------------------- anacron.spec | 43 ++++++++++----- hourly.patch | 24 ++++++++ sources | 1 + 5 files changed, 126 insertions(+), 94 deletions(-) create mode 100644 hourly.patch diff --git a/.cvsignore b/.cvsignore index 4fa487b..5ffb207 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1,3 @@ anacron_2.3.orig.tar.gz anacron.init +0hourly diff --git a/anacron.init b/anacron.init index b62fe40..160878a 100755 --- a/anacron.init +++ b/anacron.init @@ -1,99 +1,92 @@ #!/bin/sh +# Startup script for anacron # -# anacron Run cron jobs that were left out due to downtime. +# chkconfig: 2345 95 05 +# description: Run cron jobs that were left out due to downtime +# pidfile: /var/run/anacron.pid # -# chkconfig: 2345 99 05 -# description: anacron exits after it has determined it has no more work to do. \ -# Hence, its initscript cannot do normal lock file management. \ -# The anacron binary now creates its own /var/run/anacron.pid pid file \ -# and /var/lock/subsys lock files, and removes them automatically at exit, \ -# so at least there will be no more "anacron is dead but subsys locked" \ -# messages. - -### BEGIN INIT INFO -# Provides: $anacron -# Required-Start: $local_fs $syslog -# Required-Stop: $local_fs $syslog -# Default-Start: 2345 -# Default-Stop: 99 -# Short-Description: run left over cron jobs -# Description: anacron exits after it has determined it has no more work to do. -# Hence, its initscript cannot do normal lock file management. -# The anacron binary now creates its own /var/run/anacron.pid pid file -# and /var/lock/subsys lock files, and removes them automatically at exit, -# so at least there will be no more "anacron is dead but subsys locked" -# messages. -### END INIT INFO - # Source function library. . /etc/rc.d/init.d/functions -exec=/usr/sbin/anacron -prog=anacron -#config=doesn't have config file, some values are stored in /etc/anacrontab +[ -f /usr/sbin/anacron ] || exit 0 -lockfile=/var/lock/subsys/$prog +prog="anacron" +PIDFILE=/var/run/${prog}.pid +LOCKFILE=/var/lock/subsys/$prog +# +# NOTE: anacron exits after it has determined it has no more work to do. +# Hence, its initscript cannot do normal lock file management. +# The anacron binary now creates its own /var/run/anacron.pid pid file +# and /var/lock/subsys lock files, and removes them automatically at exit, +# so at least there will be no more "anacron is dead but subsys locked" +# messages. +# start() { - [ -x $exec ] || exit 5 - echo -n $"Starting $prog: " + echo -n $"Starting $prog: " + # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) + if [ -x /usr/bin/on_ac_power ]; then + /usr/bin/on_ac_power > /dev/null + if [ $? -eq 1 ]; then + echo "deferred while on battery power." + RETVAL=0 + exit 0 + fi + fi daemon +19 anacron -s - retval=$? + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + failure; + fi; echo - [ $retval -eq 0 ] - ## && touch $lockfile it creates lock in code - return $retval + return $RETVAL } stop() { echo -n $"Stopping $prog: " - killproc $prog - retval=$? + if [ -f $PIDFILE ]; then + killproc anacron + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + failure; + fi; + else + RETVAL=1 + failure; + fi echo - [ $retval -eq 0 ] - #usually anacron clean his lock after he stops himself. - #Just in case something goes wrong kill him. - [ -f $lockfile ] && rm -f $lockfile - return $retval + return $RETVAL } -restart() { - stop - start -} - -rh_status() { - # run checks to determine if the service is running or use generic status - status $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - status) - rh_status - ;; - condrestart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart}" - exit 2 -esac -exit $? + start) + start + ;; + + stop) + stop + ;; + + status) + status anacron + ;; + restart) + stop + start + ;; + + condrestart) + if [ -f $LOCKFILE ]; then + stop + start + fi + ;; + + *) + echo $"Usage: $0 {start|stop|restart|condrestart|status}" + exit 1 + +esac + +exit $RETVAL diff --git a/anacron.spec b/anacron.spec index baf3855..4ee99f4 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,13 +1,14 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 65%{?dist} +Release: 66%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron Source: http://ftp.debian.org/debian/pool/main/a/anacron/%{name}_%{version}.orig.tar.gz Source1: anacrontab Source2: anacron.init +Source3: 0hourly Patch1: anacron_2.3-13.patch Patch2: anacron-2.3-mail-content-type-77108.patch Patch3: anacron-2.3-fdclose.patch @@ -15,6 +16,7 @@ Patch4: anacron-2.3-pic.patch Patch5: anacron-2.3-memleaking.patch Patch6: anacron-2.3-spooldir.patch Patch7: anacron-2.3-hourly.patch +Patch8: hourly.patch Requires: crontabs Requires: initscripts @@ -48,6 +50,7 @@ reboots or hibernation. %patch5 -p1 -b .memleaking %patch6 -p1 -b .spool %patch7 -p1 +%patch8 -p1 %build make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} @@ -66,13 +69,17 @@ for i in cron.daily cron.weekly cron.monthly cron.hourly;do mkdir -p $RPM_BUILD_ROOT/etc/$i/ done -install -m755 fedora/anacron.daily $RPM_BUILD_ROOT/etc/cron.daily/0anacron -ln -s ../cron.daily/0anacron $RPM_BUILD_ROOT/etc/cron.weekly/0anacron -ln -s ../cron.daily/0anacron $RPM_BUILD_ROOT/etc/cron.monthly/0anacron +#install -m755 fedora/anacron.daily $RPM_BUILD_ROOT/etc/cron.daily/0anacron +#ln -s ../cron.daily/0anacron $RPM_BUILD_ROOT/etc/cron.weekly/0anacron +#ln -s ../cron.daily/0anacron $RPM_BUILD_ROOT/etc/cron.monthly/0anacron +install -m755 fedora/anacron.hourly $RPM_BUILD_ROOT/etc/cron.hourly/0anacron mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/ install -c -m755 %SOURCE2 $RPM_BUILD_ROOT/etc/rc.d/init.d/anacron +mkdir -p $RPM_BUILD_ROOT/etc/cron.d/ +install -c -m755 %SOURCE3 $RPM_BUILD_ROOT/etc/cron.d/0hourly + %clean rm -rf $RPM_BUILD_ROOT @@ -99,18 +106,25 @@ fi %config(noreplace) /etc/anacrontab %dir /var/spool/anacron/ %dir /etc/rc.d/init.d/* -/%{_mandir}/man5/* -/%{_mandir}/man8/* +%{_mandir}/man5/* +%{_mandir}/man8/* /usr/sbin/anacron -%dir /etc/cron.hourly -%dir /etc/cron.daily -%dir /etc/cron.weekly -%dir /etc/cron.monthly -%dir /etc/cron.daily/0anacron -%dir /etc/cron.weekly/0anacron -%dir /etc/cron.monthly/0anacron +%dir /etc/cron.hourly/0anacron +%attr(644,root,root) /etc/cron.d/0hourly +#%dir /etc/cron.daily/0anacron +#%dir /etc/cron.weekly/0anacron +#%dir /etc/cron.monthly/0anacron %changelog +* Mon Jan 26 2009 Marcela Mašláňová 2.3-66 +- cron.{daily,weekly,hourly,monthly} should be owned by crontabs, because + some don't have installed anacron and other cron like programmes could + be dependent +- 0anacron is now trying run all cron.{daily,weekly,...} every hour. + This should fix problem with jobs running twice, with not running jobs + after hibernation and so on. +- the random delay is in default switch off + * Fri Oct 24 2008 Marcela Mašláňová 2.3-65 - rewrite init script - using fedora guidelines SysVInitScript @@ -128,8 +142,7 @@ fi - correct spooldir logged * Thu Feb 28 2008 Marcela Maslanova 2.3-59 -- 0anacron.{daily,weekly,monthly} sterror's output also goes to - dev/null +- 0anacron.{daily,weekly,monthly} sterror's output also goes to dev/null - rhbz#435255 * Tue Feb 19 2008 Fedora Release Engineering - 2.3-58 diff --git a/hourly.patch b/hourly.patch new file mode 100644 index 0000000..e6d67e1 --- /dev/null +++ b/hourly.patch @@ -0,0 +1,24 @@ +diff -up anacron-2.3/fedora/anacron.hourly.old anacron-2.3/fedora/anacron.hourly +--- anacron-2.3/fedora/anacron.hourly.old 2008-12-01 08:49:33.000000000 +0100 ++++ anacron-2.3/fedora/anacron.hourly 2008-12-01 08:49:17.000000000 +0100 +@@ -0,0 +1,20 @@ ++#!/bin/bash ++# wait for 3:02 when /etc/crontab runs cron.daily ++if [ `date +%H` -le 4 ]; then ++ exit 0; ++fi ++ ++day=`cat /var/spool/anacron/cron.daily` ++if [ `date +%Y%m%d` = $day ]; then ++ exit 0; ++fi ++ ++# in case anacron is already running, ++# there will be log (daemon won't be running twice). ++if test -x /usr/bin/on_ac_power; then ++ /usr/bin/on_ac_power &> /dev/null ++ if test $? -eq 1; then ++ exit 0 ++ fi ++fi ++/usr/sbin/anacron -s diff --git a/sources b/sources index f016dad..2e820de 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ 9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz 094af5e05723d2c4924d60f73d738509 anacron.init +e354dcd88554723abd476f069c90069d 0hourly From 2fbe52733963516d5082d5398298d01e02f939d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Wed, 28 Jan 2009 09:46:38 +0000 Subject: [PATCH 14/31] =?UTF-8?q?Thr=20Jan=2028=202009=20Marcela=20Ma?= =?UTF-8?q?=C5=A1l=C3=A1=C5=88ov=C3=A1=20=202.3-67=20?= =?UTF-8?q?-=20482782=20output=20in=20init=20script=20redirected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- anacron.init | 4 ++-- anacron.spec | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/anacron.init b/anacron.init index 160878a..f399705 100755 --- a/anacron.init +++ b/anacron.init @@ -1,7 +1,7 @@ #!/bin/sh # Startup script for anacron # -# chkconfig: 2345 95 05 +# chkconfig: - 95 05 # description: Run cron jobs that were left out due to downtime # pidfile: /var/run/anacron.pid # @@ -26,7 +26,7 @@ start() { echo -n $"Starting $prog: " # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) if [ -x /usr/bin/on_ac_power ]; then - /usr/bin/on_ac_power > /dev/null + /usr/bin/on_ac_power > /dev/null 2>&1 if [ $? -eq 1 ]; then echo "deferred while on battery power." RETVAL=0 diff --git a/anacron.spec b/anacron.spec index 4ee99f4..eba951a 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 66%{?dist} +Release: 67%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -116,6 +116,9 @@ fi #%dir /etc/cron.monthly/0anacron %changelog +* Thr Jan 28 2009 Marcela Mašláňová 2.3-67 +- 482782 output in init script redirected + * Mon Jan 26 2009 Marcela Mašláňová 2.3-66 - cron.{daily,weekly,hourly,monthly} should be owned by crontabs, because some don't have installed anacron and other cron like programmes could From 0a0d307a397d85e89fdc13f773842199651d8815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Wed, 28 Jan 2009 12:34:43 +0000 Subject: [PATCH 15/31] - 482782 output in init script redirected --- anacron.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anacron.spec b/anacron.spec index eba951a..8b9fc33 100644 --- a/anacron.spec +++ b/anacron.spec @@ -116,7 +116,7 @@ fi #%dir /etc/cron.monthly/0anacron %changelog -* Thr Jan 28 2009 Marcela Mašláňová 2.3-67 +* Thu Jan 28 2009 Marcela Mašláňová 2.3-67 - 482782 output in init script redirected * Mon Jan 26 2009 Marcela Mašláňová 2.3-66 From 04db00a4ce36bebe500ffd32fb75ed1a5f6c6fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Mon, 2 Feb 2009 06:40:47 +0000 Subject: [PATCH 16/31] - 477709 hack aroung problems with running jobs twice - remove patches 6 a 7, they were obsoleted by this hack --- .cvsignore | 3 +++ anacron.spec | 21 ++++++++++++++++----- sources | 3 +++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.cvsignore b/.cvsignore index 4fa487b..11a19f3 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1,5 @@ anacron_2.3.orig.tar.gz anacron.init +runanacron +anacrontab +anacron.cron diff --git a/anacron.spec b/anacron.spec index 487854e..10dff84 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,20 +1,22 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 62%{?dist} +Release: 63%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron Source: http://ftp.debian.org/debian/pool/main/a/anacron/%{name}_%{version}.orig.tar.gz Source1: anacrontab Source2: anacron.init +Source3: runanacron +Source4: anacron.cron Patch0: anacron_2.3-13.patch Patch1: anacron-2.3-mail-content-type-77108.patch Patch2: anacron-2.3-fdclose.patch Patch3: anacron-2.3-pic.patch Patch4: anacron-2.3-memleaking.patch -Patch5: anacron-2.3-onbattery.patch -Patch6: anacron-2.3-sterr_null.patch +#Patch5: anacron-2.3-onbattery.patch +#Patch6: anacron-2.3-sterr_null.patch Patch7: anacron-2.3-spooldir.patch Requires: crontabs @@ -47,8 +49,8 @@ jobs of other Red Hat Linux (or Fedora) packages are executed each day. %patch2 -p1 -b .fdclose %patch3 -p1 -b .pic %patch4 -p1 -b .memleaking -%patch5 -p1 -b .onbattery -%patch6 -p1 -b .sterr +#%patch5 -p1 -b .onbattery +#%patch6 -p1 -b .sterr %patch7 -p1 -b .spool %build @@ -74,6 +76,9 @@ cp debian/0anacron.weekly $RPM_BUILD_ROOT/etc/cron.weekly/0anacron mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/ install -c -m755 %SOURCE2 $RPM_BUILD_ROOT/etc/rc.d/init.d/anacron +install -c -m755 %SOURCE3 $RPM_BUILD_ROOT/usr/sbin/runanacron +mkdir -p $RPM_BUILD_ROOT/etc/cron.d +install -m644 %SOURCE4 $RPM_BUILD_ROOT/etc/cron.d/anacron %clean rm -rf $RPM_BUILD_ROOT @@ -104,11 +109,17 @@ fi /%{_mandir}/man5/* /%{_mandir}/man8/* /usr/sbin/anacron +/usr/sbin/runanacron +/etc/cron.d/anacron %attr(755,root,root) %dir /etc/cron.daily/0anacron %attr(755,root,root) %dir /etc/cron.monthly/0anacron %attr(755,root,root) %dir /etc/cron.weekly/0anacron %changelog +* Mon Feb 2 2009 Marcela Mašláňová 2.3-63 +- 477709 hack aroung problems with running jobs twice +- remove patches 6 a 7, they were obsoleted by this hack + * Thu Oct 23 2008 Marcela Mašláňová 2.3-62 - rewrite init script - using fedora guidelines SysVInitScript diff --git a/sources b/sources index f016dad..ab465e6 100644 --- a/sources +++ b/sources @@ -1,2 +1,5 @@ 9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz 094af5e05723d2c4924d60f73d738509 anacron.init +1e65b1fcb49c7929645a1bd0baffd7ef runanacron +e4368e8f686c710f63027af0f213cfe5 anacrontab +312b5eed93765e26e9d21f23bccc72c9 anacron.cron From 3c1b0922d9aff3ba54519fac0c4a11951d6f079a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Fri, 6 Feb 2009 14:08:07 +0000 Subject: [PATCH 17/31] - add two new options: - 481775 some people don't want to run daily jobs at all, if they didn't run in specific time f.e. 4-7 hours. - 470168 random delay was removed from crontabs and added into anacron, where could be better set. - cron.d/0hourly will every hour run cron.hourly/0anacron which check whether the jobs should be running or not --- anacron-2.3-hourly.patch | 37 ------------------ anacron-2.3-random.patch | 83 ++++++++++++++++++++++++++++++++++++++++ anacron-2.3-range.patch | 61 +++++++++++++++++++++++++++++ anacron.spec | 61 +++++++++++------------------ anacrontab | 10 +++-- hourly.patch | 24 ------------ manAUX_Limit.patch | 52 +++++++++++++++++++++++++ sources | 2 +- 8 files changed, 226 insertions(+), 104 deletions(-) delete mode 100644 anacron-2.3-hourly.patch create mode 100644 anacron-2.3-random.patch create mode 100644 anacron-2.3-range.patch delete mode 100644 hourly.patch create mode 100644 manAUX_Limit.patch diff --git a/anacron-2.3-hourly.patch b/anacron-2.3-hourly.patch deleted file mode 100644 index e28ded5..0000000 --- a/anacron-2.3-hourly.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff -up anacron-2.3/fedora/anacron.daily.old anacron-2.3/fedora/anacron.daily ---- anacron-2.3/fedora/anacron.daily.old 2008-05-30 14:02:27.000000000 +0200 -+++ anacron-2.3/fedora/anacron.daily 2008-05-30 13:59:13.000000000 +0200 -@@ -0,0 +1,33 @@ -+#!/bin/bash -+# wait for 3:02 when /etc/crontab runs cron.daily -+if [ `date +%H` -le 4 ]; then -+ exit 0; -+fi -+ -+#delay - more computers on one line don't receive updates at the same time -+[ -f /etc/sysconfig/crontab ] && . /etc/sysconfig/crontab -+if [ ! -z "$DELAY" ]; then -+ if [ "$DELAY" != "0" ]; then -+ # Create md5sum of hostname (static over system lifetime) -+ md5sum="`echo ${HOSTNAME} | md5sum`" -+ -+ # Extract the first 3 hexdigits (12 Bit: 0-4095) -+ hexvalue="${md5sum:0:3}" -+ -+ # Create decimal value -+ decvalue="`printf "%d" "0x${hexvalue}"`" -+ -+ # Divide delay by factor -+ T_DELAY=$[ ${decvalue} / ${DELAY} ] -+ sleep $T_DELAY -+ fi -+fi -+# in case anacron is already running, -+# there will be log (daemon won't be running twice). -+if test -x /usr/bin/on_ac_power; then -+ /usr/bin/on_ac_power &> /dev/null -+ if test $? -eq 1; then -+ exit 0 -+ fi -+fi -+/usr/sbin/anacron -s diff --git a/anacron-2.3-random.patch b/anacron-2.3-random.patch new file mode 100644 index 0000000..6ad1428 --- /dev/null +++ b/anacron-2.3-random.patch @@ -0,0 +1,83 @@ +diff -up anacron-2.3/main.c.aux anacron-2.3/main.c +--- anacron-2.3/main.c.aux 2009-02-06 12:58:17.000000000 +0100 ++++ anacron-2.3/main.c 2009-02-06 12:59:44.000000000 +0100 +@@ -24,6 +24,7 @@ + + + #include ++#include + #include + #include + #include +@@ -430,6 +431,13 @@ main(int argc, char *argv[]) + + anacrontab = NULL; + spooldir = NULL; ++ struct timeval tv; ++ struct timezone tz; ++ ++ if (gettimeofday(&tv, &tz) != 0) ++ explain("Can't get exact time, failure."); ++ ++ srandom(getpid()+tv.tv_usec); + + if((program_name = strrchr(argv[0], '/')) == NULL) + program_name = argv[0]; +diff -up anacron-2.3/readtab.c.aux anacron-2.3/readtab.c +--- anacron-2.3/readtab.c.aux 2009-02-06 12:58:17.000000000 +0100 ++++ anacron-2.3/readtab.c 2009-02-06 12:58:17.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 */ + ++static int RANDOM; ++ + /* some definitions for the obstack macros */ + #define obstack_chunk_alloc xmalloc + #define obstack_chunk_free free +@@ -144,6 +146,15 @@ register_env(const char *env_var, const + Debug(("on line %d: %s", line_num, er->assign)); + } + ++static int ++random_delay(int delay) { ++ int i = random(); ++ double x = 0; ++ ++ x = (double) i / (double) RAND_MAX * (double) delay; ++ return (int)x; ++} ++ + static void + register_job(const char *periods, const char *delays, + const char *ident, char *command) +@@ -167,6 +178,8 @@ register_job(const char *periods, const + jr = obstack_alloc(&tab_o, sizeof(job_rec)); + jr->period = period; + jr->named_period = 0; ++ if (RANDOM > 0) ++ delay += random_delay(RANDOM); + jr->delay = delay; + jr->tab_line = line_num; + jr->ident = obstack_alloc(&tab_o, ident_len + 1); +@@ -215,6 +228,8 @@ register_period_job(const char *periods, + anacrontab, line_num); + } + jr->period = 0; ++ if (RANDOM > 0) ++ delay += random_delay(RANDOM); + jr->delay = delay; + jr->tab_line = line_num; + jr->ident = obstack_alloc(&tab_o, ident_len + 1); +@@ -257,7 +272,10 @@ parse_tab_line(char *line) + &env_var, &value); + if ((r != -1) && (strcmp(env_var, "START_HOURS_RANGE") == NULL)) + r = match_rx("^([[:digit:]]+)-([[:digit:]]+)$", value, 0); +- ++ if (strncmp(env_var, "RANDOM_DELAY", 12) == NULL) { ++ r = match_rx("([[:digit:]]+)$", value, 1); ++ RANDOM = atoi(value); ++ } + if (r == -1) goto reg_err; + if (r) + { diff --git a/anacron-2.3-range.patch b/anacron-2.3-range.patch new file mode 100644 index 0000000..e953d5a --- /dev/null +++ b/anacron-2.3-range.patch @@ -0,0 +1,61 @@ +diff -up anacron-2.3/readtab.c.range anacron-2.3/readtab.c +--- anacron-2.3/readtab.c.range 2009-02-06 13:04:08.000000000 +0100 ++++ anacron-2.3/readtab.c 2009-02-06 13:05:13.000000000 +0100 +@@ -255,6 +255,9 @@ parse_tab_line(char *line) + /* an environment assignment? */ + r = match_rx("^[ \t]*([^ \t=]+)[ \t]*=(.*)$", line, 2, + &env_var, &value); ++ if ((r != -1) && (strcmp(env_var, "START_HOURS_RANGE") == NULL)) ++ r = match_rx("^([[:digit:]]+)-([[:digit:]]+)$", value, 0); ++ + if (r == -1) goto reg_err; + if (r) + { +diff -up anacron-2.3/runjob.c.range anacron-2.3/runjob.c +--- anacron-2.3/runjob.c.range 2009-02-06 13:04:08.000000000 +0100 ++++ anacron-2.3/runjob.c 2009-02-06 13:11:42.000000000 +0100 +@@ -34,8 +34,9 @@ + #include + #include + #include "global.h" +- ++#include + #include ++#include + + static int + temp_file(job_rec *jr) +@@ -236,14 +237,31 @@ launch_job(job_rec *jr) + int fd; + char hostname[512]; + char *mailto; +- ++ char *limit; ++ char *from; ++ char *to; ++ time_t now; ++ struct tm t; ++ int len; + /* get hostname */ + if (gethostname(hostname, 512)) { + strcpy (hostname,"unknown machine"); + } + + setup_env(jr); +- ++ ++ limit = getenv("START_HOURS_RANGE"); ++ time(&now); ++ t = *localtime(&now); ++ if (limit != NULL) { ++ if ((match_rx("^([[:digit:]]+)-([[:digit:]]+)$", limit, 2, &from, &to) == -1) || ++ (from == NULL) || (to == NULL)) ++ explain("START_HOURS_RANGE wasn't set correctly: %s", limit); ++ 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)); ++ return 1; ++ } ++ } + /* Get the destination email address if set, or current user otherwise */ + mailto = getenv("MAILTO"); + diff --git a/anacron.spec b/anacron.spec index 8b9fc33..7cc9772 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,22 +1,23 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 67%{?dist} +Release: 68%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron Source: http://ftp.debian.org/debian/pool/main/a/anacron/%{name}_%{version}.orig.tar.gz Source1: anacrontab -Source2: anacron.init -Source3: 0hourly +Source2: 0hourly +Source3: anacron Patch1: anacron_2.3-13.patch Patch2: anacron-2.3-mail-content-type-77108.patch Patch3: anacron-2.3-fdclose.patch Patch4: anacron-2.3-pic.patch Patch5: anacron-2.3-memleaking.patch Patch6: anacron-2.3-spooldir.patch -Patch7: anacron-2.3-hourly.patch -Patch8: hourly.patch +Patch7: anacron-2.3-range.patch +Patch8: anacron-2.3-random.patch +Patch9: manAUX_Limit.patch Requires: crontabs Requires: initscripts @@ -49,8 +50,9 @@ reboots or hibernation. %patch4 -p1 -b .pic %patch5 -p1 -b .memleaking %patch6 -p1 -b .spool -%patch7 -p1 -%patch8 -p1 +%patch7 -p1 -b .range +%patch8 -p1 -b .random +%patch9 -p1 %build make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} @@ -69,53 +71,34 @@ for i in cron.daily cron.weekly cron.monthly cron.hourly;do mkdir -p $RPM_BUILD_ROOT/etc/$i/ done -#install -m755 fedora/anacron.daily $RPM_BUILD_ROOT/etc/cron.daily/0anacron -#ln -s ../cron.daily/0anacron $RPM_BUILD_ROOT/etc/cron.weekly/0anacron -#ln -s ../cron.daily/0anacron $RPM_BUILD_ROOT/etc/cron.monthly/0anacron -install -m755 fedora/anacron.hourly $RPM_BUILD_ROOT/etc/cron.hourly/0anacron - -mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/ -install -c -m755 %SOURCE2 $RPM_BUILD_ROOT/etc/rc.d/init.d/anacron - mkdir -p $RPM_BUILD_ROOT/etc/cron.d/ -install -c -m755 %SOURCE3 $RPM_BUILD_ROOT/etc/cron.d/0hourly +install -c -m755 %SOURCE2 $RPM_BUILD_ROOT/etc/cron.d/0hourly +install -c -m755 %SOURCE3 $RPM_BUILD_ROOT/etc/cron.hourly/0anacron -%clean +%clean rm -rf $RPM_BUILD_ROOT -%post -/sbin/chkconfig --add anacron -if [ "$1" -ge 1 ]; then - /sbin/chkconfig --level 2345 anacron resetpriorities -fi - -%preun -if [ "$1" = "0" ]; then - service anacron stop >/dev/null 2>&1 ||: - /sbin/chkconfig --del anacron -fi - -%postun -if [ "$1" -ge "1" ]; then - service anacron condrestart >/dev/null 2>&1 ||: -fi - %files %defattr(-,root,root,0755) %doc COPYING README %config(noreplace) /etc/anacrontab %dir /var/spool/anacron/ -%dir /etc/rc.d/init.d/* %{_mandir}/man5/* %{_mandir}/man8/* /usr/sbin/anacron -%dir /etc/cron.hourly/0anacron %attr(644,root,root) /etc/cron.d/0hourly -#%dir /etc/cron.daily/0anacron -#%dir /etc/cron.weekly/0anacron -#%dir /etc/cron.monthly/0anacron +%attr(755,root,root) /etc/cron.hourly/0anacron %changelog +* Fri Feb 6 2009 Marcela Mašláňová 2.3-68 +- add two new options: +- 481775 some people don't want to run daily jobs at all, if they + didn't run in specific time f.e. 4-7 hours. +- 470168 random delay was removed from crontabs and added into + anacron, where could be better set. +- cron.d/0hourly will every hour run cron.hourly/0anacron which + check whether the jobs should be running or not + * Thu Jan 28 2009 Marcela Mašláňová 2.3-67 - 482782 output in init script redirected diff --git a/anacrontab b/anacrontab index 8108dbc..9c78121 100644 --- a/anacrontab +++ b/anacrontab @@ -5,7 +5,11 @@ SHELL=/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root +# the maximal random delay +RANDOM_DELAY=45 +# in between this hours will started daily jobs +#START_HOURS_RANGE=3-22 -1 65 cron.daily nice run-parts /etc/cron.daily -7 70 cron.weekly nice run-parts /etc/cron.weekly -@monthly 75 cron.monthly nice run-parts /etc/cron.monthly +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 diff --git a/hourly.patch b/hourly.patch deleted file mode 100644 index e6d67e1..0000000 --- a/hourly.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -up anacron-2.3/fedora/anacron.hourly.old anacron-2.3/fedora/anacron.hourly ---- anacron-2.3/fedora/anacron.hourly.old 2008-12-01 08:49:33.000000000 +0100 -+++ anacron-2.3/fedora/anacron.hourly 2008-12-01 08:49:17.000000000 +0100 -@@ -0,0 +1,20 @@ -+#!/bin/bash -+# wait for 3:02 when /etc/crontab runs cron.daily -+if [ `date +%H` -le 4 ]; then -+ exit 0; -+fi -+ -+day=`cat /var/spool/anacron/cron.daily` -+if [ `date +%Y%m%d` = $day ]; then -+ exit 0; -+fi -+ -+# in case anacron is already running, -+# there will be log (daemon won't be running twice). -+if test -x /usr/bin/on_ac_power; then -+ /usr/bin/on_ac_power &> /dev/null -+ if test $? -eq 1; then -+ exit 0 -+ fi -+fi -+/usr/sbin/anacron -s diff --git a/manAUX_Limit.patch b/manAUX_Limit.patch new file mode 100644 index 0000000..fb249a6 --- /dev/null +++ b/manAUX_Limit.patch @@ -0,0 +1,52 @@ +diff -up anacron-2.3/anacrontab.5.mmm anacron-2.3/anacrontab.5 +--- anacron-2.3/anacrontab.5.mmm 2009-02-04 14:40:29.000000000 +0100 ++++ anacron-2.3/anacrontab.5 2009-02-04 14:56:56.000000000 +0100 +@@ -1,4 +1,4 @@ +-.TH ANACRONTAB 5 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" ++.TH ANACRONTAB 5 2009-02-02 "Marcela Mašláňová" "Anacron Users' Manual" + .SH NAME + /etc/anacrontab \- configuration file for anacron + .SH DESCRIPTION +@@ -19,7 +19,11 @@ The + .I period + is specified in days, the + .I delay +-in minutes. The ++in minutes. It could be also defined random delay which is set by value of ++.I RANDOM_DELAY ++. The value in this variable denotes maximal delay. ++The random delay is added to normal delay from anacrontab. Also the random delay could ++be set to zero or not set at all. The + .I job-identifier + can contain any non-blank character, except slashes. It is used to identify + the job in Anacron messages, +@@ -42,12 +46,28 @@ are removed. No spaces around + .I VALUE + are allowed (unless you want them to be part of the value). The assignment + takes effect from the next line to the end of the file, or to the next +-assignment of the same variable. ++assignment of the same variable. The enviroment variable ++.I START_HOURS_RANGE ++sets the time frame, when the job could started. + .PP + Empty lines are either blank lines, line containing white-space only, or + lines with white-space followed by a '#' followed by an arbitrary comment. + .PP + You can continue a line onto the next line by ending it with a '\'. ++.SH EXAMPLE ++.nf ++# environment variable ++SHELL=/bin/sh ++PATH=/sbin:/bin:/usr/sbin:/usr/bin ++MAILTO=root ++RANDOM_DELAY=60 ++# Anacron jobs will start between 6 and 8 o'clock. ++START_HOURS_RANGE=6-8 ++# delay will be 5 minutes + RANDOM_DELAY for cron.daily ++1 5 cron.daily nice run-parts /etc/cron.daily ++7 8 cron.weekly nice run-parts /etc/cron.weekly ++@monthly 35 cron.monthly nice run-parts /etc/cron.monthly ++.fi + .SH "SEE ALSO" + .B anacron(8) + .PP diff --git a/sources b/sources index 2e820de..3a3c33b 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ 9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz -094af5e05723d2c4924d60f73d738509 anacron.init e354dcd88554723abd476f069c90069d 0hourly +489b434e72a434ead53efc941330cb59 anacron From 967a35b81ed842dad7ab57f0f7d28ef29db28eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Tue, 10 Feb 2009 09:58:12 +0000 Subject: [PATCH 18/31] - apply fix of my previous range patch from tmraz - fix man page --- anacron-2.3-random.patch | 29 ++++++++++---------- anacron-2.3-range.patch | 59 ++++++++++++++++++++++++++-------------- anacron.spec | 6 +++- anacrontab | 6 ++-- manAUX_Limit.patch | 31 ++++++++++++++------- 5 files changed, 81 insertions(+), 50 deletions(-) diff --git a/anacron-2.3-random.patch b/anacron-2.3-random.patch index 6ad1428..4bd3070 100644 --- a/anacron-2.3-random.patch +++ b/anacron-2.3-random.patch @@ -1,6 +1,6 @@ -diff -up anacron-2.3/main.c.aux anacron-2.3/main.c ---- anacron-2.3/main.c.aux 2009-02-06 12:58:17.000000000 +0100 -+++ anacron-2.3/main.c 2009-02-06 12:59:44.000000000 +0100 +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 @@ -24,6 +24,7 @@ @@ -23,9 +23,9 @@ diff -up anacron-2.3/main.c.aux anacron-2.3/main.c if((program_name = strrchr(argv[0], '/')) == NULL) program_name = argv[0]; -diff -up anacron-2.3/readtab.c.aux anacron-2.3/readtab.c ---- anacron-2.3/readtab.c.aux 2009-02-06 12:58:17.000000000 +0100 -+++ anacron-2.3/readtab.c 2009-02-06 12:58:17.000000000 +0100 +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 @@ -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,15 +69,14 @@ diff -up anacron-2.3/readtab.c.aux anacron-2.3/readtab.c jr->delay = delay; jr->tab_line = line_num; jr->ident = obstack_alloc(&tab_o, ident_len + 1); -@@ -257,7 +272,10 @@ parse_tab_line(char *line) - &env_var, &value); - if ((r != -1) && (strcmp(env_var, "START_HOURS_RANGE") == NULL)) - r = match_rx("^([[:digit:]]+)-([[:digit:]]+)$", value, 0); -- -+ if (strncmp(env_var, "RANDOM_DELAY", 12) == NULL) { -+ r = match_rx("([[:digit:]]+)$", value, 1); -+ RANDOM = atoi(value); -+ } +@@ -258,6 +273,10 @@ parse_tab_line(char *line) if (r == -1) goto reg_err; if (r) { ++ if (strncmp(env_var, "RANDOM_DELAY", 12) == NULL) { ++ r = match_rx("([[:digit:]]+)$", value, 1); ++ RANDOM = atoi(value); ++ } + if (strcmp(env_var, "START_HOURS_RANGE") == 0) + { + r = match_rx("^[[:digit:]]+-[[:digit:]]+$", value, 0); diff --git a/anacron-2.3-range.patch b/anacron-2.3-range.patch index e953d5a..12792f4 100644 --- a/anacron-2.3-range.patch +++ b/anacron-2.3-range.patch @@ -1,19 +1,27 @@ diff -up anacron-2.3/readtab.c.range anacron-2.3/readtab.c ---- anacron-2.3/readtab.c.range 2009-02-06 13:04:08.000000000 +0100 -+++ anacron-2.3/readtab.c 2009-02-06 13:05:13.000000000 +0100 -@@ -255,6 +255,9 @@ parse_tab_line(char *line) - /* an environment assignment? */ - r = match_rx("^[ \t]*([^ \t=]+)[ \t]*=(.*)$", line, 2, - &env_var, &value); -+ if ((r != -1) && (strcmp(env_var, "START_HOURS_RANGE") == NULL)) -+ r = match_rx("^([[:digit:]]+)-([[:digit:]]+)$", value, 0); -+ +--- 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) 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; ++ } ++ } + register_env(env_var, value); + return; + } diff -up anacron-2.3/runjob.c.range anacron-2.3/runjob.c ---- anacron-2.3/runjob.c.range 2009-02-06 13:04:08.000000000 +0100 -+++ anacron-2.3/runjob.c 2009-02-06 13:11:42.000000000 +0100 +--- 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 @@ -34,8 +34,9 @@ #include #include @@ -25,7 +33,7 @@ diff -up anacron-2.3/runjob.c.range anacron-2.3/runjob.c static int temp_file(job_rec *jr) -@@ -236,14 +237,31 @@ launch_job(job_rec *jr) +@@ -236,14 +237,40 @@ launch_job(job_rec *jr) int fd; char hostname[512]; char *mailto; @@ -34,8 +42,7 @@ diff -up anacron-2.3/runjob.c.range anacron-2.3/runjob.c + char *from; + char *to; + time_t now; -+ struct tm t; -+ int len; ++ struct tm *t; /* get hostname */ if (gethostname(hostname, 512)) { strcpy (hostname,"unknown machine"); @@ -45,16 +52,26 @@ diff -up anacron-2.3/runjob.c.range anacron-2.3/runjob.c - + + limit = getenv("START_HOURS_RANGE"); -+ time(&now); -+ t = *localtime(&now); -+ if (limit != NULL) { ++ if (limit != NULL) ++ limit = strdup(limit); ++ if (limit != NULL) ++ { ++ time(&now); ++ t = localtime(&now); + if ((match_rx("^([[:digit:]]+)-([[:digit:]]+)$", limit, 2, &from, &to) == -1) || + (from == NULL) || (to == NULL)) -+ explain("START_HOURS_RANGE wasn't set correctly: %s", limit); -+ 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)); -+ return 1; ++ { ++ complain("START_HOURS_RANGE wasn't set correctly: %s", limit); ++ free(limit); ++ return; + } ++ 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)); ++ free(limit); ++ return; ++ } ++ free(limit); + } /* Get the destination email address if set, or current user otherwise */ mailto = getenv("MAILTO"); diff --git a/anacron.spec b/anacron.spec index 7cc9772..df23efb 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 68%{?dist} +Release: 69%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -90,6 +90,10 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/cron.hourly/0anacron %changelog +* Tue Feb 10 2009 Marcela Mašláňová 2.3-69 +- apply fix of my previous range patch from tmraz +- fix man page + * Fri Feb 6 2009 Marcela Mašláňová 2.3-68 - add two new options: - 481775 some people don't want to run daily jobs at all, if they diff --git a/anacrontab b/anacrontab index 9c78121..0b99878 100644 --- a/anacrontab +++ b/anacrontab @@ -5,10 +5,10 @@ SHELL=/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root -# the maximal random delay +# the maximal random delay added to the base delay of the jobs RANDOM_DELAY=45 -# in between this hours will started daily jobs -#START_HOURS_RANGE=3-22 +# the jobs will be started during the following hours only +START_HOURS_RANGE=3-22 1 5 cron.daily nice run-parts /etc/cron.daily 7 25 cron.weekly nice run-parts /etc/cron.weekly diff --git a/manAUX_Limit.patch b/manAUX_Limit.patch index fb249a6..4a6f0bc 100644 --- a/manAUX_Limit.patch +++ b/manAUX_Limit.patch @@ -1,26 +1,37 @@ diff -up anacron-2.3/anacrontab.5.mmm anacron-2.3/anacrontab.5 ---- anacron-2.3/anacrontab.5.mmm 2009-02-04 14:40:29.000000000 +0100 -+++ anacron-2.3/anacrontab.5 2009-02-04 14:56:56.000000000 +0100 +--- anacron-2.3/anacrontab.5.mmm 2009-02-10 10:42:17.000000000 +0100 ++++ anacron-2.3/anacrontab.5 2009-02-10 10:51:26.000000000 +0100 @@ -1,4 +1,4 @@ -.TH ANACRONTAB 5 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" +.TH ANACRONTAB 5 2009-02-02 "Marcela Mašláňová" "Anacron Users' Manual" .SH NAME /etc/anacrontab \- configuration file for anacron .SH DESCRIPTION -@@ -19,7 +19,11 @@ The +@@ -15,11 +15,20 @@ Job-description lines are of one of thes + .PP + @period_name delay job-identify command + .PP +-The ++The .I period - is specified in days, the +-is specified in days, the ++is specified in days, the .I delay -in minutes. The -+in minutes. It could be also defined random delay which is set by value of ++in minutes. In addition, if the +.I RANDOM_DELAY -+. The value in this variable denotes maximal delay. -+The random delay is added to normal delay from anacrontab. Also the random delay could -+be set to zero or not set at all. The ++environment variable is set, then the value of ++.I RANDOM_DELAY ++is added to the delay. The value in ++.I RANDOM_DELAY ++denotes a maximal additional delay in minutes, where the minimum delay value is set, to user delay from anacrontab. A ++.I RANDOM_DELAY ++set to 12 would therefore add, randomly, between 0 and 12 minutes to the user defined delay. ++The .I job-identifier can contain any non-blank character, except slashes. It is used to identify the job in Anacron messages, -@@ -42,12 +46,28 @@ are removed. No spaces around +@@ -42,12 +51,28 @@ are removed. No spaces around .I VALUE are allowed (unless you want them to be part of the value). The assignment takes effect from the next line to the end of the file, or to the next @@ -35,7 +46,7 @@ diff -up anacron-2.3/anacrontab.5.mmm anacron-2.3/anacrontab.5 You can continue a line onto the next line by ending it with a '\'. +.SH EXAMPLE +.nf -+# environment variable ++# environment variables +SHELL=/bin/sh +PATH=/sbin:/bin:/usr/sbin:/usr/bin +MAILTO=root From e76c227507b823e5a3c9499f5c10d997f3f96020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Thu, 19 Feb 2009 14:06:19 +0000 Subject: [PATCH 19/31] - 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 | 136 +++++++++++++++++++++++++++++ anacron-2.3-random.patch | 24 ++--- anacron-2.3-range.patch | 28 +++--- anacron.spec | 9 +- anacrontab | 1 + 5 files changed, 172 insertions(+), 26 deletions(-) create mode 100644 anacron-2.3-log_jobs_correct.patch diff --git a/anacron-2.3-log_jobs_correct.patch b/anacron-2.3-log_jobs_correct.patch new file mode 100644 index 0000000..874f261 --- /dev/null +++ b/anacron-2.3-log_jobs_correct.patch @@ -0,0 +1,136 @@ +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 + #include "global.h" + #include "gregor.h" ++#include + + 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; + } diff --git a/anacron-2.3-random.patch b/anacron-2.3-random.patch index 4bd3070..d1b3f1e 100644 --- a/anacron-2.3-random.patch +++ b/anacron-2.3-random.patch @@ -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 @@ diff -up anacron-2.3/main.c.random anacron-2.3/main.c 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 @@ diff -up anacron-2.3/readtab.c.random anacron-2.3/readtab.c 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; + } diff --git a/anacron-2.3-range.patch b/anacron-2.3-range.patch index 12792f4..26084cb 100644 --- a/anacron-2.3-range.patch +++ b/anacron-2.3-range.patch @@ -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 #include diff --git a/anacron.spec b/anacron.spec index df23efb..132e784 100644 --- a/anacron.spec +++ b/anacron.spec @@ -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 @@ Patch6: anacron-2.3-spooldir.patch 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 @@ reboots or hibernation. %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 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/cron.hourly/0anacron %changelog +* Thu Feb 19 2009 Marcela Mašláňová 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á 2.3-69 - apply fix of my previous range patch from tmraz - fix man page diff --git a/anacrontab b/anacrontab index 0b99878..78c6f8c 100644 --- a/anacrontab +++ b/anacrontab @@ -10,6 +10,7 @@ RANDOM_DELAY=45 # 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 From 17ed917047fac95b7339e80977c406c22cc97158 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Tue, 24 Feb 2009 01:04:09 +0000 Subject: [PATCH 20/31] - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild --- anacron.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/anacron.spec b/anacron.spec index 132e784..16d8096 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 70%{?dist} +Release: 71%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -92,6 +92,9 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/cron.hourly/0anacron %changelog +* Mon Feb 23 2009 Fedora Release Engineering - 2.3-71 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + * Thu Feb 19 2009 Marcela Mašláňová 2.3-70 - incorrect logging of jobs - fixed number of executed jobs - really planed jobs are mentioned From 1e6c8f235984e077d14a24bee77d09134bebd7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Fri, 6 Mar 2009 08:14:58 +0000 Subject: [PATCH 21/31] Fix typo in anacron again. --- anacron.spec | 5 ++++- sources | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/anacron.spec b/anacron.spec index 16d8096..0341d8f 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 71%{?dist} +Release: 72%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -92,6 +92,9 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/cron.hourly/0anacron %changelog +* Fri Mar 6 2009 Marcela Mašláňová 2.3-72 +- 488916 fix typo in bash script again. + * Mon Feb 23 2009 Fedora Release Engineering - 2.3-71 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild diff --git a/sources b/sources index 3a3c33b..feef057 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ 9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz e354dcd88554723abd476f069c90069d 0hourly -489b434e72a434ead53efc941330cb59 anacron +110558bab1719a8b91598fdcfceebed0 anacron From 9871122470fd6be931fd16224c7c8f5001b6be41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Fri, 27 Mar 2009 09:43:13 +0000 Subject: [PATCH 22/31] - rewrite the range and random patches with checking log to one more lucid with help of tmraz. --- anacron-2.3-range-rnd.patch | 199 ++++++++++++++++++++++++++++++++++++ anacron.spec | 16 +-- manAUX_Limit.patch | 41 +++++++- 3 files changed, 246 insertions(+), 10 deletions(-) create mode 100644 anacron-2.3-range-rnd.patch diff --git a/anacron-2.3-range-rnd.patch b/anacron-2.3-range-rnd.patch new file mode 100644 index 0000000..26906be --- /dev/null +++ b/anacron-2.3-range-rnd.patch @@ -0,0 +1,199 @@ +diff -up anacron-2.3.new/main.c.range-rnd anacron-2.3.new/main.c +--- anacron-2.3.new/main.c.range-rnd 2009-03-24 10:12:23.000000000 +0100 ++++ anacron-2.3.new/main.c 2009-03-24 12:01:24.000000000 +0100 +@@ -24,6 +24,7 @@ + + + #include ++#include + #include + #include + #include +@@ -31,6 +32,7 @@ + #include + #include + #include ++#include + #include "global.h" + #include "gregor.h" + +@@ -56,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 */ ++int range_start = -1; ++int range_stop = -1; + + static void + print_version() +@@ -402,6 +406,7 @@ static void + explain_intentions() + { + int j; ++ struct tm *t; + + j = 0; + while (j < njobs) +@@ -412,8 +417,21 @@ explain_intentions() + } + else + { +- explain("Will run job `%s' in %d min.", ++ 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.", + job_array[j]->ident, job_array[j]->delay); ++ } + } + j++; + } +@@ -428,8 +446,17 @@ main(int argc, char *argv[]) + + int cwd; + ++ int dropped_jobs = 0; ++ + anacrontab = NULL; + spooldir = NULL; ++ struct timeval tv; ++ struct timezone tz; ++ ++ if (gettimeofday(&tv, &tz) != 0) ++ explain("Can't get exact time, failure."); ++ ++ srandom(getpid()+tv.tv_usec); + + if((program_name = strrchr(argv[0], '/')) == NULL) + program_name = argv[0]; +@@ -486,11 +513,16 @@ 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, (njobs == 1 ? "" : "s")); ++ explain("Normal exit (%d job%s run)", njobs-dropped_jobs, (njobs == 1 ? "" : "s")); + exit(0); + } +diff -up anacron-2.3.new/global.h.range-rnd anacron-2.3.new/global.h +--- anacron-2.3.new/global.h.range-rnd 2009-03-24 10:12:23.000000000 +0100 ++++ anacron-2.3.new/global.h 2009-03-24 12:01:10.000000000 +0100 +@@ -68,6 +68,7 @@ struct job_rec1 { + int mail_header_size; + pid_t job_pid; + pid_t mailer_pid; ++ int drop_job; + + struct job_rec1 *next; + env_rec *prev_env_rec; +@@ -100,6 +101,10 @@ extern int running_jobs,running_mailers; + + extern int complaints; + ++/* time ranges for START_HOURS_RANGE */ ++extern int range_start; ++extern int range_stop; ++ + /* Function prototypes */ + + /* main.c */ +diff -up anacron-2.3.new/log.c.range-rnd anacron-2.3.new/log.c +--- anacron-2.3.new/log.c.range-rnd 2009-03-24 10:12:23.000000000 +0100 ++++ anacron-2.3.new/log.c 2009-03-24 12:01:56.000000000 +0100 +@@ -43,6 +43,7 @@ + #include + #include + #include ++#include + #include "global.h" + + static char truncated[] = " (truncated)"; +diff -up anacron-2.3.new/readtab.c.range-rnd anacron-2.3.new/readtab.c +--- anacron-2.3.new/readtab.c.range-rnd 2009-03-24 10:12:23.000000000 +0100 ++++ anacron-2.3.new/readtab.c 2009-03-24 11:51:08.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 */ + ++static int random_number = 0; ++ + /* some definitions for the obstack macros */ + #define obstack_chunk_alloc xmalloc + #define obstack_chunk_free free +@@ -167,6 +169,7 @@ register_job(const char *periods, const + jr = obstack_alloc(&tab_o, sizeof(job_rec)); + jr->period = period; + jr->named_period = 0; ++ delay += random_number; + jr->delay = delay; + jr->tab_line = line_num; + jr->ident = obstack_alloc(&tab_o, ident_len + 1); +@@ -215,6 +218,7 @@ register_period_job(const char *periods, + anacrontab, line_num); + } + jr->period = 0; ++ delay += random_number; + jr->delay = delay; + jr->tab_line = line_num; + jr->ident = obstack_alloc(&tab_o, ident_len + 1); +@@ -242,6 +246,8 @@ parse_tab_line(char *line) + char *delays; + char *ident; + char *command; ++ char *from; ++ char *to; + + /* an empty line? */ + r = match_rx("^[ \t]*($|#)", line, 0); +@@ -258,6 +264,25 @@ parse_tab_line(char *line) + if (r == -1) goto reg_err; + if (r) + { ++ if (strncmp(env_var, "START_HOURS_RANGE", 17) == 0) ++ { ++ r = match_rx("^([[:digit:]]+)-([[:digit:]]+)$", value, 2, &from, &to); ++ if ((r == -1) || (from == NULL) || (to == NULL)) goto reg_invalid; ++ range_start = atoi(from); ++ range_stop = atoi(to); ++ Debug(("Jobs will start in the %02d:00-%02d:00 range.", range_start, range_stop)); ++ } ++ if (strncmp(env_var, "RANDOM_DELAY", 12) == 0) { ++ r = match_rx("^([[:digit:]]+)$", value, 1); ++ if (r != -1) { ++ int i = random(); ++ double x = 0; ++ x = (double) i / (double) RAND_MAX * (double) (atoi(value)); ++ random_number = (int)x; ++ Debug(("Randomized delay set: %d", random_number)); ++ } ++ else goto reg_invalid; ++ } + register_env(env_var, value); + return; + } +@@ -284,6 +309,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 --git a/anacron.spec b/anacron.spec index 0341d8f..7f38892 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 72%{?dist} +Release: 73%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -15,10 +15,10 @@ Patch3: anacron-2.3-fdclose.patch Patch4: anacron-2.3-pic.patch Patch5: anacron-2.3-memleaking.patch Patch6: anacron-2.3-spooldir.patch -Patch7: anacron-2.3-range.patch -Patch8: anacron-2.3-random.patch +#Patch7: anacron-2.3-range.patch +#Patch8: anacron-2.3-random.patch Patch9: manAUX_Limit.patch -Patch10: anacron-2.3-log_jobs_correct.patch +Patch10: anacron-2.3-range-rnd.patch Requires: crontabs Requires: initscripts @@ -51,8 +51,8 @@ reboots or hibernation. %patch4 -p1 -b .pic %patch5 -p1 -b .memleaking %patch6 -p1 -b .spool -%patch7 -p1 -b .range -%patch8 -p1 -b .random +#%patch7 -p1 -b .range +#%patch8 -p1 -b .random %patch9 -p1 %patch10 -p1 -b .fix @@ -92,6 +92,10 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/cron.hourly/0anacron %changelog +* Fri Mar 27 2009 Marcela Mašláňová 2.3-73 +- rewrite the range and random patches with checking log to one + more lucid with help of tmraz. + * Fri Mar 6 2009 Marcela Mašláňová 2.3-72 - 488916 fix typo in bash script again. diff --git a/manAUX_Limit.patch b/manAUX_Limit.patch index 4a6f0bc..87e6d09 100644 --- a/manAUX_Limit.patch +++ b/manAUX_Limit.patch @@ -1,9 +1,36 @@ -diff -up anacron-2.3/anacrontab.5.mmm anacron-2.3/anacrontab.5 ---- anacron-2.3/anacrontab.5.mmm 2009-02-10 10:42:17.000000000 +0100 -+++ anacron-2.3/anacrontab.5 2009-02-10 10:51:26.000000000 +0100 +diff -up anacron-2.3/anacron.8.aux anacron-2.3/anacron.8 +--- anacron-2.3/anacron.8.aux 2009-03-24 14:16:39.000000000 +0100 ++++ anacron-2.3/anacron.8 2009-03-24 14:22:41.000000000 +0100 +@@ -1,4 +1,4 @@ +-.TH ANACRON 8 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" ++.TH ANACRON 8 2009-03-24 "Marcela Mašláňová" "Anacron Users' Manual" + .SH NAME + anacron \- runs commands periodically + .SH SYNOPSIS +@@ -66,8 +66,8 @@ exists. If the LOGNAME environment varia + field. + .PP + Informative messages about what Anacron is doing are sent to \fBsyslogd(8)\fR +-under facility \fBcron\fR, priority \fBnotice\fR. Error messages are sent at +-priority \fBerror\fR. ++or \fBrsyslogd(8)\fR under facility \fBcron\fR, priority \fBnotice\fR. Error ++messages are sent at priority \fBerror\fR. + .PP + "Active" jobs (i.e. jobs that Anacron already decided + to run and now wait for their delay to pass, and jobs that are currently +@@ -163,4 +163,5 @@ The current implementation is a complete + The code base was maintained by Sean 'Shaleh' Perry . + .PP + Since 2004, it is maintained by Pascal Hakim . +- ++.PP ++For Fedora is anacron maintained by Marcela Mašláňová . +diff -up anacron-2.3/anacrontab.5.aux anacron-2.3/anacrontab.5 +--- anacron-2.3/anacrontab.5.aux 2009-03-24 14:16:39.000000000 +0100 ++++ anacron-2.3/anacrontab.5 2009-03-24 14:23:39.000000000 +0100 @@ -1,4 +1,4 @@ -.TH ANACRONTAB 5 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" -+.TH ANACRONTAB 5 2009-02-02 "Marcela Mašláňová" "Anacron Users' Manual" ++.TH ANACRONTAB 5 2009-03-24 "Marcela Mašláňová" "Anacron Users' Manual" .SH NAME /etc/anacrontab \- configuration file for anacron .SH DESCRIPTION @@ -61,3 +88,9 @@ diff -up anacron-2.3/anacrontab.5.mmm anacron-2.3/anacrontab.5 .SH "SEE ALSO" .B anacron(8) .PP +@@ -58,3 +83,5 @@ file. + Itai Tzur + .PP + Currently maintained by Pascal Hakim . ++.PP ++For Fedora maintained by Marcela Mašláňová . From b633ca9231e45c4ff7b5adc51f60c851997344ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Tue, 14 Apr 2009 14:16:40 +0000 Subject: [PATCH 23/31] - 495333 fix ungrammatical job(s) in log --- anacron-2.3-range-rnd.patch | 2 +- anacron.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/anacron-2.3-range-rnd.patch b/anacron-2.3-range-rnd.patch index 26906be..b5d5b17 100644 --- a/anacron-2.3-range-rnd.patch +++ b/anacron-2.3-range-rnd.patch @@ -90,7 +90,7 @@ diff -up anacron-2.3.new/main.c.range-rnd anacron-2.3.new/main.c } wait_children(); - explain("Normal exit (%d job%s run)", njobs, (njobs == 1 ? "" : "s")); -+ explain("Normal exit (%d job%s run)", njobs-dropped_jobs, (njobs == 1 ? "" : "s")); ++ explain("Normal exit (%d job%s run)", njobs-dropped_jobs, (njobs-dropped_jobs == 1 ? "" : "s")); exit(0); } diff -up anacron-2.3.new/global.h.range-rnd anacron-2.3.new/global.h diff --git a/anacron.spec b/anacron.spec index 7f38892..de94389 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 73%{?dist} +Release: 74%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -92,6 +92,9 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/cron.hourly/0anacron %changelog +* Tue Apr 14 2009 Marcela Mašláňová 2.3-74 +- 495333 fix ungrammatical job(s) in log + * Fri Mar 27 2009 Marcela Mašláňová 2.3-73 - rewrite the range and random patches with checking log to one more lucid with help of tmraz. From 483a8bad0295a44a6681caae4ee09610f75c8d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Fri, 15 May 2009 11:58:51 +0000 Subject: [PATCH 24/31] Enviroment values must be set for cronjob. --- anacron.spec | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/anacron.spec b/anacron.spec index de94389..0559610 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 74%{?dist} +Release: 75%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -15,10 +15,8 @@ Patch3: anacron-2.3-fdclose.patch Patch4: anacron-2.3-pic.patch Patch5: anacron-2.3-memleaking.patch Patch6: anacron-2.3-spooldir.patch -#Patch7: anacron-2.3-range.patch -#Patch8: anacron-2.3-random.patch -Patch9: manAUX_Limit.patch -Patch10: anacron-2.3-range-rnd.patch +Patch7: manAUX_Limit.patch +Patch8: anacron-2.3-range-rnd.patch Requires: crontabs Requires: initscripts @@ -51,10 +49,8 @@ reboots or hibernation. %patch4 -p1 -b .pic %patch5 -p1 -b .memleaking %patch6 -p1 -b .spool -#%patch7 -p1 -b .range -#%patch8 -p1 -b .random -%patch9 -p1 -%patch10 -p1 -b .fix +%patch7 -p1 +%patch8 -p1 -b .fix %build make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} @@ -92,6 +88,9 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/cron.hourly/0anacron %changelog +* Fri May 15 2009 Marcela Mašláňová 2.3-75 +- 500694 missing enviroments values in crontab, which runs cron.{daily,weekly...} + * Tue Apr 14 2009 Marcela Mašláňová 2.3-74 - 495333 fix ungrammatical job(s) in log From 8a736b2eb135744826b9f91180d0e34fba53a886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Fri, 15 May 2009 12:24:10 +0000 Subject: [PATCH 25/31] - and now upload new source --- anacron.spec | 5 ++++- sources | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/anacron.spec b/anacron.spec index 0559610..108b122 100644 --- a/anacron.spec +++ b/anacron.spec @@ -1,7 +1,7 @@ Summary: A cron-like program that can run jobs lost during downtime Name: anacron Version: 2.3 -Release: 75%{?dist} +Release: 76%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://packages.debian.org/stable/source/anacron @@ -88,6 +88,9 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/cron.hourly/0anacron %changelog +* Fri May 15 2009 Marcela Mašláňová 2.3-76 +- and now upload new source + * Fri May 15 2009 Marcela Mašláňová 2.3-75 - 500694 missing enviroments values in crontab, which runs cron.{daily,weekly...} diff --git a/sources b/sources index feef057..08ba32e 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ 9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz -e354dcd88554723abd476f069c90069d 0hourly 110558bab1719a8b91598fdcfceebed0 anacron +4b98b6b029e76aa6e0fa3fde2ec5572a 0hourly From 8a3fc308bb0e12bf9d98a3582fa552fde7f8b3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Tue, 30 Jun 2009 13:14:34 +0000 Subject: [PATCH 26/31] #507598 in case lock doesn't exist then the script spam user about non existent file. --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index 08ba32e..648d5cf 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ 9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz -110558bab1719a8b91598fdcfceebed0 anacron 4b98b6b029e76aa6e0fa3fde2ec5572a 0hourly +e2d8c06a7b5c46b30317456ffd9d312d anacron From c684c1163ef810303dc3a6aa872871837d224a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Mon, 20 Jul 2009 18:22:12 +0000 Subject: [PATCH 27/31] This package has been obsoleted by cronie. --- anacron-2.3-fdclose.patch | 107 -- anacron-2.3-log_jobs_correct.patch | 136 -- anacron-2.3-mail-content-type-77108.patch | 22 - anacron-2.3-memleaking.patch | 182 --- anacron-2.3-pic.patch | 12 - anacron-2.3-random.patch | 82 -- anacron-2.3-range-rnd.patch | 199 --- anacron-2.3-range.patch | 80 - anacron-2.3-spooldir.patch | 12 - anacron.init | 92 -- anacron.spec | 406 ----- anacron_2.3-13.patch | 1630 --------------------- anacrontab | 16 - manAUX_Limit.patch | 96 -- 14 files changed, 3072 deletions(-) delete mode 100644 anacron-2.3-fdclose.patch delete mode 100644 anacron-2.3-log_jobs_correct.patch delete mode 100644 anacron-2.3-mail-content-type-77108.patch delete mode 100644 anacron-2.3-memleaking.patch delete mode 100644 anacron-2.3-pic.patch delete mode 100644 anacron-2.3-random.patch delete mode 100644 anacron-2.3-range-rnd.patch delete mode 100644 anacron-2.3-range.patch delete mode 100644 anacron-2.3-spooldir.patch delete mode 100755 anacron.init delete mode 100644 anacron.spec delete mode 100644 anacron_2.3-13.patch delete mode 100644 anacrontab delete mode 100644 manAUX_Limit.patch diff --git a/anacron-2.3-fdclose.patch b/anacron-2.3-fdclose.patch deleted file mode 100644 index 4ee0bc9..0000000 --- a/anacron-2.3-fdclose.patch +++ /dev/null @@ -1,107 +0,0 @@ -diff -up anacron-2.3/global.h.fdclose anacron-2.3/global.h ---- anacron-2.3/global.h.fdclose 2008-09-23 10:06:04.000000000 +0200 -+++ anacron-2.3/global.h 2008-09-23 10:06:04.000000000 +0200 -@@ -63,6 +63,7 @@ struct job_rec1 { - int tab_line; - int arg_num; - int timestamp_fd; -+ int input_fd; - int output_fd; - int mail_header_size; - pid_t job_pid; -diff -up anacron-2.3/runjob.c.fdclose anacron-2.3/runjob.c ---- anacron-2.3/runjob.c.fdclose 2008-09-23 10:06:04.000000000 +0200 -+++ anacron-2.3/runjob.c 2008-09-23 10:06:04.000000000 +0200 -@@ -38,12 +38,12 @@ - #include - - static int --temp_file() -+temp_file(job_rec *jr) - /* Open a temporary file and return its file descriptor */ - { - const int max_retries = 50; - char *name; -- int fd, i; -+ int fdin, fdout, i; - - i = 0; - name = NULL; -@@ -53,16 +53,24 @@ temp_file() - free(name); - name = tempnam(NULL, NULL); - if (name == NULL) die("Can't find a unique temporary filename"); -- fd = open(name, O_RDWR | O_CREAT | O_EXCL | O_APPEND, -- S_IRUSR | S_IWUSR); -+ fdout = open(name, O_WRONLY | O_CREAT | O_EXCL | O_APPEND, -+ S_IRUSR | S_IWUSR); -+ if ( fdout != -1 ) -+ fdin = open(name, O_RDONLY, S_IRUSR | S_IWUSR); - /* I'm not sure we actually need to be so persistent here */ -- } while (fd == -1 && errno == EEXIST && i < max_retries); -+ } while (fdout == -1 && errno == EEXIST && i < max_retries); - -- if (fd == -1) die_e("Can't open temporary file"); -+ if (fdout == -1) die_e("Can't open temporary file for writing"); -+ if (fdin == -1) die_e("Can't open temporary file for reading"); - if (unlink(name)) die_e("Can't unlink temporary file"); - free(name); -- fcntl(fd, F_SETFD, 1); /* set close-on-exec flag */ -- return fd; -+ fcntl(fdout, F_SETFD, 1); /* set close-on-exec flag */ -+ fcntl(fdin, F_SETFD, 1); /* set close-on-exec flag */ -+ -+ jr->input_fd = fdin; -+ jr->output_fd = fdout; -+ -+ return fdout; - } - - static off_t -@@ -167,17 +175,28 @@ launch_mailer(job_rec *jr) - pid = xfork(); - if (pid == 0) - { -+ long fdflags; -+ - /* child */ - in_background = 1; - /* set stdin to the job's output */ - xclose(0); -- if (dup2(jr->output_fd, 0) != 0) die_e("Can't dup2()"); -+ if (dup2(jr->input_fd, 0) != 0) die_e("Can't dup2()"); - if (lseek(0, 0, SEEK_SET) != 0) die_e("Can't lseek()"); - umask(old_umask); - if (sigprocmask(SIG_SETMASK, &old_sigmask, NULL)) - die_e("sigprocmask error"); - xcloselog(); - -+ /* Ensure stdout/stderr are sane before exec-ing sendmail */ -+ xclose(1); xopen(1, "/dev/null", O_WRONLY); -+ xclose(2); xopen(2, "/dev/null", O_WRONLY); -+ xclose(jr->output_fd); -+ -+ /* Ensure stdin is not appendable ... ? */ -+ /* fdflags = fcntl(0, F_GETFL); fdflags &= ~O_APPEND; */ -+ /* fcntl(0, F_SETFL, fdflags ); */ -+ - /* Here, I basically mirrored the way /usr/sbin/sendmail is called - * by cron on a Debian system, except for the "-oem" and "-or0s" - * options, which don't seem to be appropriate here. -@@ -236,7 +255,7 @@ launch_job(job_rec *jr) - jr->mailto = username (); - - /* create temporary file for stdout and stderr of the job */ -- fd = jr->output_fd = temp_file(); -+ temp_file(jr); fd = jr->output_fd; - /* write mail header */ - xwrite(fd, "From: "); - xwrite(fd, "Anacron <"); -@@ -302,6 +321,7 @@ tend_job(job_rec *jr, int status) - running_jobs--; - if (mail_output) launch_mailer(jr); - xclose(jr->output_fd); -+ xclose(jr->input_fd); - } - - void diff --git a/anacron-2.3-log_jobs_correct.patch b/anacron-2.3-log_jobs_correct.patch deleted file mode 100644 index 874f261..0000000 --- a/anacron-2.3-log_jobs_correct.patch +++ /dev/null @@ -1,136 +0,0 @@ -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 - #include "global.h" - #include "gregor.h" -+#include - - 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; - } diff --git a/anacron-2.3-mail-content-type-77108.patch b/anacron-2.3-mail-content-type-77108.patch deleted file mode 100644 index b5d0a39..0000000 --- a/anacron-2.3-mail-content-type-77108.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -up anacron-2.3/runjob.c.charset anacron-2.3/runjob.c ---- anacron-2.3/runjob.c.charset 2008-09-23 09:42:49.000000000 +0200 -+++ anacron-2.3/runjob.c 2008-09-23 09:42:49.000000000 +0200 -@@ -35,6 +35,8 @@ - #include - #include "global.h" - -+#include -+ - static int - temp_file() - /* Open a temporary file and return its file descriptor */ -@@ -247,6 +249,9 @@ launch_job(job_rec *jr) - xwrite(fd, username()); - } - xwrite(fd, "\n"); -+ xwrite(fd, "Content-Type: text/plain; charset=\""); -+ xwrite(fd, nl_langinfo(CODESET)); -+ xwrite(fd, "\"\n"); - xwrite(fd, "Subject: Anacron job '"); - xwrite(fd, jr->ident); - xwrite(fd, "' on "); diff --git a/anacron-2.3-memleaking.patch b/anacron-2.3-memleaking.patch deleted file mode 100644 index a4d3b9a..0000000 --- a/anacron-2.3-memleaking.patch +++ /dev/null @@ -1,182 +0,0 @@ ---- anacron-2.3/gregor.c.mem 2007-08-08 10:02:58.000000000 +0200 -+++ anacron-2.3/gregor.c 2007-08-08 10:10:55.000000000 +0200 -@@ -27,7 +27,7 @@ - #include - #include "gregor.h" - --const static int -+static const int - days_in_month[] = { - 31, /* Jan */ - 28, /* Feb (non-leap) */ ---- anacron-2.3/log.c.mem 2007-08-08 10:02:58.000000000 +0200 -+++ anacron-2.3/log.c 2007-08-08 10:13:03.000000000 +0200 -@@ -83,7 +83,7 @@ - } - - static void --log(int priority, const char *fmt, va_list args) -+slog(int priority, const char *fmt, va_list args) - /* Log a message, described by "fmt" and "args", with the specified - * "priority". */ - { -@@ -101,7 +101,7 @@ - - static void - log_e(int priority, const char *fmt, va_list args) --/* Same as log(), but also appends an error description corresponding -+/* Same as slog(), but also appends an error description corresponding - * to "errno". */ - { - int saved_errno; -@@ -127,7 +127,7 @@ - va_list args; - - va_start(args, fmt); -- log(EXPLAIN_LEVEL, fmt, args); -+ slog(EXPLAIN_LEVEL, fmt, args); - va_end(args); - } - -@@ -149,7 +149,7 @@ - va_list args; - - va_start(args, fmt); -- log(COMPLAIN_LEVEL, fmt, args); -+ slog(COMPLAIN_LEVEL, fmt, args); - va_end(args); - - complaints += 1; -@@ -175,7 +175,7 @@ - va_list args; - - va_start(args, fmt); -- log(COMPLAIN_LEVEL, fmt, args); -+ slog(COMPLAIN_LEVEL, fmt, args); - va_end(args); - if (getpid() == primary_pid) complain("Aborted"); - -@@ -207,7 +207,7 @@ - va_list args; - - va_start(args, fmt); -- log(DEBUG_LEVEL, fmt, args); -+ slog(DEBUG_LEVEL, fmt, args); - va_end(args); - } - ---- anacron-2.3/global.h.mem 2007-08-08 10:02:58.000000000 +0200 -+++ anacron-2.3/global.h 2007-08-08 10:10:21.000000000 +0200 -@@ -105,18 +105,25 @@ - /* main.c */ - int xopen(int fd, const char *file_name, int flags); - void xclose(int fd); --pid_t xfork(); -+pid_t xfork(void); -+ -+#ifdef __GNUC__ -+#define PRINTF_FORMAT(n, m) \ -+ __attribute__ ((format (printf, n, m))) -+#else -+#define PRINTF_FORMAT(n, m) -+#endif - - /* log.c */ --void explain(const char *fmt, ...); --void explain_e(const char *fmt, ...); --void complain(const char *fmt, ...); --void complain_e(const char *fmt, ...); --void die(const char *fmt, ...); --void die_e(const char *fmt, ...); --void xdebug(const char *fmt, ...); --void xdebug_e(const char *fmt, ...); --void xcloselog(); -+void explain(const char *fmt, ...)PRINTF_FORMAT(1,2); -+void explain_e(const char *fmt, ...)PRINTF_FORMAT(1,2); -+void complain(const char *fmt, ...)PRINTF_FORMAT(1,2); -+void complain_e(const char *fmt, ...)PRINTF_FORMAT(1,2); -+void die(const char *fmt, ...)PRINTF_FORMAT(1,2); -+void die_e(const char *fmt, ...)PRINTF_FORMAT(1,2); -+void xdebug(const char *fmt, ...)PRINTF_FORMAT(1,2); -+void xdebug_e(const char *fmt, ...)PRINTF_FORMAT(1,2); -+void xcloselog(void); - - #ifdef DEBUG - #define Debug(args) xdebug args -@@ -128,7 +135,7 @@ - - /* readtab.c */ - void read_tab(int cwd); --void arrange_jobs(); -+void arrange_jobs(void); - - /* lock.c */ - int consider_job(job_rec *jr); ---- anacron-2.3/runjob.c.mem 2007-08-08 10:02:58.000000000 +0200 -+++ anacron-2.3/runjob.c 2007-08-08 10:17:44.000000000 +0200 -@@ -64,8 +64,8 @@ - if (fdin == -1) die_e("Can't open temporary file for reading"); - if (unlink(name)) die_e("Can't unlink temporary file"); - free(name); -- fcntl(fdout, F_SETFD, 1); /* set close-on-exec flag */ -- fcntl(fdin, F_SETFD, 1); /* set close-on-exec flag */ -+ fcntl(fdout, F_SETFD, FD_CLOEXEC); /* set close-on-exec flag */ -+ fcntl(fdin, F_SETFD, FD_CLOEXEC); /* set close-on-exec flag */ - - jr->input_fd = fdin; - jr->output_fd = fdout; -@@ -175,8 +175,6 @@ - pid = xfork(); - if (pid == 0) - { -- long fdflags; -- - /* child */ - in_background = 1; - /* set stdin to the job's output */ ---- anacron-2.3/matchrx.c.mem 2000-06-21 01:12:18.000000000 +0200 -+++ anacron-2.3/matchrx.c 2007-08-08 10:16:54.000000000 +0200 -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include "matchrx.h" - - int -@@ -49,11 +50,20 @@ - sub_offsets = malloc(sizeof(regmatch_t) * (n_sub + 1)); - memset(sub_offsets, 0, sizeof(regmatch_t) * (n_sub + 1)); - -- if (regcomp(&crx, rx, REG_EXTENDED)) return - 1; -+ if (regcomp(&crx, rx, REG_EXTENDED)) { -+ free(sub_offsets); -+ return - 1; -+ } - r = regexec(&crx, string, n_sub + 1, sub_offsets, 0); -- if (r != 0 && r != REG_NOMATCH) return - 1; -+ if (r != 0 && r != REG_NOMATCH) { -+ free(sub_offsets); -+ return - 1; -+ } - regfree(&crx); -- if (r == REG_NOMATCH) return 0; -+ if (r == REG_NOMATCH) { -+ free(sub_offsets); -+ return 0; -+ } - - va_start(va, n_sub); - n = 1; -@@ -62,7 +72,10 @@ - substring = va_arg(va, char**); - if (substring != NULL) - { -- if (sub_offsets[n].rm_so == -1) return - 1; -+ if (sub_offsets[n].rm_so == -1) { -+ free(sub_offsets); -+ return - 1; -+ } - *substring = string + sub_offsets[n].rm_so; - *(string + sub_offsets[n].rm_eo) = 0; - } diff --git a/anacron-2.3-pic.patch b/anacron-2.3-pic.patch deleted file mode 100644 index 5cb26d7..0000000 --- a/anacron-2.3-pic.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- anacron-2.3/Makefile.piee 2006-10-17 12:39:39.000000000 +0200 -+++ anacron-2.3/Makefile 2006-10-17 12:39:39.000000000 +0200 -@@ -22,7 +22,8 @@ - PREFIX = - BINDIR = $(PREFIX)/usr/sbin - MANDIR = $(PREFIX)/usr/man --CFLAGS = -Wall -pedantic -O2 -+LDFLAGS = -fpie -Wl,-z,relro -+CFLAGS = -Wall -pedantic -W -Wundef -fpie - #CFLAGS = -Wall -O2 -g -DDEBUG - - # If you change these, please update the man-pages too diff --git a/anacron-2.3-random.patch b/anacron-2.3-random.patch deleted file mode 100644 index d1b3f1e..0000000 --- a/anacron-2.3-random.patch +++ /dev/null @@ -1,82 +0,0 @@ -diff -up anacron-2.3/main.c.random anacron-2.3/main.c ---- 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 @@ - - - #include -+#include - #include - #include - #include -@@ -430,6 +431,13 @@ main(int argc, char *argv[]) - - anacrontab = NULL; - spooldir = NULL; -+ struct timeval tv; -+ struct timezone tz; -+ -+ if (gettimeofday(&tv, &tz) != 0) -+ explain("Can't get exact time, failure."); -+ -+ srandom(getpid()+tv.tv_usec); - - 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-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 */ - -+static int RANDOM; -+ - /* some definitions for the obstack macros */ - #define obstack_chunk_alloc xmalloc - #define obstack_chunk_free free -@@ -144,6 +146,15 @@ register_env(const char *env_var, const - Debug(("on line %d: %s", line_num, er->assign)); - } - -+static int -+random_delay(int delay) { -+ int i = random(); -+ double x = 0; -+ -+ x = (double) i / (double) RAND_MAX * (double) delay; -+ return (int)x; -+} -+ - static void - register_job(const char *periods, const char *delays, - const char *ident, char *command) -@@ -167,6 +178,8 @@ register_job(const char *periods, const - jr = obstack_alloc(&tab_o, sizeof(job_rec)); - jr->period = period; - jr->named_period = 0; -+ if (RANDOM > 0) -+ delay += random_delay(RANDOM); - jr->delay = delay; - jr->tab_line = line_num; - jr->ident = obstack_alloc(&tab_o, ident_len + 1); -@@ -215,6 +228,8 @@ register_period_job(const char *periods, - anacrontab, line_num); - } - jr->period = 0; -+ if (RANDOM > 0) -+ delay += random_delay(RANDOM); - jr->delay = delay; - jr->tab_line = line_num; - jr->ident = obstack_alloc(&tab_o, ident_len + 1); -@@ -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); -+ RANDOM = atoi(value); -+ } - register_env(env_var, value); - return; - } diff --git a/anacron-2.3-range-rnd.patch b/anacron-2.3-range-rnd.patch deleted file mode 100644 index b5d5b17..0000000 --- a/anacron-2.3-range-rnd.patch +++ /dev/null @@ -1,199 +0,0 @@ -diff -up anacron-2.3.new/main.c.range-rnd anacron-2.3.new/main.c ---- anacron-2.3.new/main.c.range-rnd 2009-03-24 10:12:23.000000000 +0100 -+++ anacron-2.3.new/main.c 2009-03-24 12:01:24.000000000 +0100 -@@ -24,6 +24,7 @@ - - - #include -+#include - #include - #include - #include -@@ -31,6 +32,7 @@ - #include - #include - #include -+#include - #include "global.h" - #include "gregor.h" - -@@ -56,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 */ -+int range_start = -1; -+int range_stop = -1; - - static void - print_version() -@@ -402,6 +406,7 @@ static void - explain_intentions() - { - int j; -+ struct tm *t; - - j = 0; - while (j < njobs) -@@ -412,8 +417,21 @@ explain_intentions() - } - else - { -- explain("Will run job `%s' in %d min.", -+ 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.", - job_array[j]->ident, job_array[j]->delay); -+ } - } - j++; - } -@@ -428,8 +446,17 @@ main(int argc, char *argv[]) - - int cwd; - -+ int dropped_jobs = 0; -+ - anacrontab = NULL; - spooldir = NULL; -+ struct timeval tv; -+ struct timezone tz; -+ -+ if (gettimeofday(&tv, &tz) != 0) -+ explain("Can't get exact time, failure."); -+ -+ srandom(getpid()+tv.tv_usec); - - if((program_name = strrchr(argv[0], '/')) == NULL) - program_name = argv[0]; -@@ -486,11 +513,16 @@ 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, (njobs == 1 ? "" : "s")); -+ explain("Normal exit (%d job%s run)", njobs-dropped_jobs, (njobs-dropped_jobs == 1 ? "" : "s")); - exit(0); - } -diff -up anacron-2.3.new/global.h.range-rnd anacron-2.3.new/global.h ---- anacron-2.3.new/global.h.range-rnd 2009-03-24 10:12:23.000000000 +0100 -+++ anacron-2.3.new/global.h 2009-03-24 12:01:10.000000000 +0100 -@@ -68,6 +68,7 @@ struct job_rec1 { - int mail_header_size; - pid_t job_pid; - pid_t mailer_pid; -+ int drop_job; - - struct job_rec1 *next; - env_rec *prev_env_rec; -@@ -100,6 +101,10 @@ extern int running_jobs,running_mailers; - - extern int complaints; - -+/* time ranges for START_HOURS_RANGE */ -+extern int range_start; -+extern int range_stop; -+ - /* Function prototypes */ - - /* main.c */ -diff -up anacron-2.3.new/log.c.range-rnd anacron-2.3.new/log.c ---- anacron-2.3.new/log.c.range-rnd 2009-03-24 10:12:23.000000000 +0100 -+++ anacron-2.3.new/log.c 2009-03-24 12:01:56.000000000 +0100 -@@ -43,6 +43,7 @@ - #include - #include - #include -+#include - #include "global.h" - - static char truncated[] = " (truncated)"; -diff -up anacron-2.3.new/readtab.c.range-rnd anacron-2.3.new/readtab.c ---- anacron-2.3.new/readtab.c.range-rnd 2009-03-24 10:12:23.000000000 +0100 -+++ anacron-2.3.new/readtab.c 2009-03-24 11:51:08.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 */ - -+static int random_number = 0; -+ - /* some definitions for the obstack macros */ - #define obstack_chunk_alloc xmalloc - #define obstack_chunk_free free -@@ -167,6 +169,7 @@ register_job(const char *periods, const - jr = obstack_alloc(&tab_o, sizeof(job_rec)); - jr->period = period; - jr->named_period = 0; -+ delay += random_number; - jr->delay = delay; - jr->tab_line = line_num; - jr->ident = obstack_alloc(&tab_o, ident_len + 1); -@@ -215,6 +218,7 @@ register_period_job(const char *periods, - anacrontab, line_num); - } - jr->period = 0; -+ delay += random_number; - jr->delay = delay; - jr->tab_line = line_num; - jr->ident = obstack_alloc(&tab_o, ident_len + 1); -@@ -242,6 +246,8 @@ parse_tab_line(char *line) - char *delays; - char *ident; - char *command; -+ char *from; -+ char *to; - - /* an empty line? */ - r = match_rx("^[ \t]*($|#)", line, 0); -@@ -258,6 +264,25 @@ parse_tab_line(char *line) - if (r == -1) goto reg_err; - if (r) - { -+ if (strncmp(env_var, "START_HOURS_RANGE", 17) == 0) -+ { -+ r = match_rx("^([[:digit:]]+)-([[:digit:]]+)$", value, 2, &from, &to); -+ if ((r == -1) || (from == NULL) || (to == NULL)) goto reg_invalid; -+ range_start = atoi(from); -+ range_stop = atoi(to); -+ Debug(("Jobs will start in the %02d:00-%02d:00 range.", range_start, range_stop)); -+ } -+ if (strncmp(env_var, "RANDOM_DELAY", 12) == 0) { -+ r = match_rx("^([[:digit:]]+)$", value, 1); -+ if (r != -1) { -+ int i = random(); -+ double x = 0; -+ x = (double) i / (double) RAND_MAX * (double) (atoi(value)); -+ random_number = (int)x; -+ Debug(("Randomized delay set: %d", random_number)); -+ } -+ else goto reg_invalid; -+ } - register_env(env_var, value); - return; - } -@@ -284,6 +309,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 --git a/anacron-2.3-range.patch b/anacron-2.3-range.patch deleted file mode 100644 index 26084cb..0000000 --- a/anacron-2.3-range.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff -up anacron-2.3/readtab.c.range anacron-2.3/readtab.c ---- 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_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-16 10:20:08.000000000 +0100 -+++ anacron-2.3/runjob.c 2009-02-16 10:20:08.000000000 +0100 -@@ -34,8 +34,9 @@ - #include - #include - #include "global.h" -- -+#include - #include -+#include - - static int - temp_file(job_rec *jr) -@@ -236,14 +237,40 @@ launch_job(job_rec *jr) - int fd; - char hostname[512]; - char *mailto; -- -+ char *limit; -+ char *from; -+ char *to; -+ time_t now; -+ struct tm *t; - /* get hostname */ - if (gethostname(hostname, 512)) { - strcpy (hostname,"unknown machine"); - } - - setup_env(jr); -- -+ -+ limit = getenv("START_HOURS_RANGE"); -+ if (limit != NULL) -+ limit = strdup(limit); -+ if (limit != NULL) -+ { -+ time(&now); -+ t = localtime(&now); -+ if ((match_rx("^([[:digit:]]+)-([[:digit:]]+)$", limit, 2, &from, &to) == -1) || -+ (from == NULL) || (to == NULL)) -+ { -+ complain("START_HOURS_RANGE wasn't set correctly: %s", limit); -+ free(limit); -+ return; -+ } -+ 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)); -+ free(limit); -+ return; -+ } -+ free(limit); -+ } - /* Get the destination email address if set, or current user otherwise */ - mailto = getenv("MAILTO"); - diff --git a/anacron-2.3-spooldir.patch b/anacron-2.3-spooldir.patch deleted file mode 100644 index a748e9e..0000000 --- a/anacron-2.3-spooldir.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up anacron-2.3/readtab.c.spool anacron-2.3/readtab.c ---- anacron-2.3/readtab.c.spool 2008-04-09 11:04:21.000000000 +0200 -+++ anacron-2.3/readtab.c 2008-04-09 11:23:09.000000000 +0200 -@@ -305,7 +305,7 @@ read_tab(int cwd) - /* Open the anacrontab file */ - fchdir (cwd); - tab = fopen(anacrontab, "r"); -- if (chdir(spooldir)) die_e("Can't chdir to %s", SPOOLDIR); -+ if (chdir(spooldir)) die_e("Can't chdir to %s", spooldir); - - if (tab == NULL) die_e("Error opening %s", anacrontab); - /* Initialize the obstacks */ diff --git a/anacron.init b/anacron.init deleted file mode 100755 index f399705..0000000 --- a/anacron.init +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh -# Startup script for anacron -# -# chkconfig: - 95 05 -# description: Run cron jobs that were left out due to downtime -# pidfile: /var/run/anacron.pid -# -# Source function library. -. /etc/rc.d/init.d/functions - -[ -f /usr/sbin/anacron ] || exit 0 - -prog="anacron" -PIDFILE=/var/run/${prog}.pid -LOCKFILE=/var/lock/subsys/$prog -# -# NOTE: anacron exits after it has determined it has no more work to do. -# Hence, its initscript cannot do normal lock file management. -# The anacron binary now creates its own /var/run/anacron.pid pid file -# and /var/lock/subsys lock files, and removes them automatically at exit, -# so at least there will be no more "anacron is dead but subsys locked" -# messages. -# - -start() { - echo -n $"Starting $prog: " - # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) - if [ -x /usr/bin/on_ac_power ]; then - /usr/bin/on_ac_power > /dev/null 2>&1 - if [ $? -eq 1 ]; then - echo "deferred while on battery power." - RETVAL=0 - exit 0 - fi - fi - daemon +19 anacron -s - RETVAL=$? - if [ $RETVAL -ne 0 ]; then - failure; - fi; - echo - return $RETVAL -} - -stop() { - echo -n $"Stopping $prog: " - if [ -f $PIDFILE ]; then - killproc anacron - RETVAL=$? - if [ $RETVAL -ne 0 ]; then - failure; - fi; - else - RETVAL=1 - failure; - fi - echo - return $RETVAL -} - -case "$1" in - start) - start - ;; - - stop) - stop - ;; - - status) - status anacron - ;; - - restart) - stop - start - ;; - - condrestart) - if [ -f $LOCKFILE ]; then - stop - start - fi - ;; - - *) - echo $"Usage: $0 {start|stop|restart|condrestart|status}" - exit 1 - -esac - -exit $RETVAL diff --git a/anacron.spec b/anacron.spec deleted file mode 100644 index 108b122..0000000 --- a/anacron.spec +++ /dev/null @@ -1,406 +0,0 @@ -Summary: A cron-like program that can run jobs lost during downtime -Name: anacron -Version: 2.3 -Release: 76%{?dist} -License: GPLv2+ -Group: System Environment/Base -URL: http://packages.debian.org/stable/source/anacron -Source: http://ftp.debian.org/debian/pool/main/a/anacron/%{name}_%{version}.orig.tar.gz -Source1: anacrontab -Source2: 0hourly -Source3: anacron -Patch1: anacron_2.3-13.patch -Patch2: anacron-2.3-mail-content-type-77108.patch -Patch3: anacron-2.3-fdclose.patch -Patch4: anacron-2.3-pic.patch -Patch5: anacron-2.3-memleaking.patch -Patch6: anacron-2.3-spooldir.patch -Patch7: manAUX_Limit.patch -Patch8: anacron-2.3-range-rnd.patch - -Requires: crontabs -Requires: initscripts -Requires(post): /sbin/chkconfig -Requires(preun): /sbin/chkconfig -Requires(postun): /sbin/service -Requires(preun): /sbin/service -BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot - -%description -Anacron (like `anac(h)ronistic') is a periodic command scheduler. -It executes commands at intervals specified in days. Unlike cron, it -does not assume that the system is running continuously. It can -therefore be used to control the execution of daily, weekly and -monthly jobs (or anything with a period of n days), on systems that -don't run 24 hours a day. When installed and configured properly, -Anacron will make sure that the commands are run at the specified -intervals as closely as machine-uptime permits. - -This package is pre-configured to execute the daily jobs of the Red -Hat Linux (or Fedora) system. It's part of triple - cronie, anacron -and crontabs, which care about execution of jobs also with often -reboots or hibernation. - -%prep -%setup -q -%patch1 -p1 -b .try -%patch2 -p1 -b .charset -%patch3 -p1 -b .fdclose -%patch4 -p1 -b .pic -%patch5 -p1 -b .memleaking -%patch6 -p1 -b .spool -%patch7 -p1 -%patch8 -p1 -b .fix - -%build -make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/{etc/,usr/sbin/,%{_mandir}/man5,%{_mandir}/man8/} -mkdir -p $RPM_BUILD_ROOT/var/spool/anacron/ - -cp anacron $RPM_BUILD_ROOT/usr/sbin -cp anacron.8 $RPM_BUILD_ROOT/%{_mandir}/man8/ -cp anacrontab.5 $RPM_BUILD_ROOT/%{_mandir}/man5/ -cp %SOURCE1 $RPM_BUILD_ROOT/etc - -for i in cron.daily cron.weekly cron.monthly cron.hourly;do -mkdir -p $RPM_BUILD_ROOT/etc/$i/ -done - -mkdir -p $RPM_BUILD_ROOT/etc/cron.d/ -install -c -m755 %SOURCE2 $RPM_BUILD_ROOT/etc/cron.d/0hourly -install -c -m755 %SOURCE3 $RPM_BUILD_ROOT/etc/cron.hourly/0anacron - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root,0755) -%doc COPYING README -%config(noreplace) /etc/anacrontab -%dir /var/spool/anacron/ -%{_mandir}/man5/* -%{_mandir}/man8/* -/usr/sbin/anacron -%attr(644,root,root) /etc/cron.d/0hourly -%attr(755,root,root) /etc/cron.hourly/0anacron - -%changelog -* Fri May 15 2009 Marcela Mašláňová 2.3-76 -- and now upload new source - -* Fri May 15 2009 Marcela Mašláňová 2.3-75 -- 500694 missing enviroments values in crontab, which runs cron.{daily,weekly...} - -* Tue Apr 14 2009 Marcela Mašláňová 2.3-74 -- 495333 fix ungrammatical job(s) in log - -* Fri Mar 27 2009 Marcela Mašláňová 2.3-73 -- rewrite the range and random patches with checking log to one - more lucid with help of tmraz. - -* Fri Mar 6 2009 Marcela Mašláňová 2.3-72 -- 488916 fix typo in bash script again. - -* Mon Feb 23 2009 Fedora Release Engineering - 2.3-71 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - -* Thu Feb 19 2009 Marcela Mašláňová 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á 2.3-69 -- apply fix of my previous range patch from tmraz -- fix man page - -* Fri Feb 6 2009 Marcela Mašláňová 2.3-68 -- add two new options: -- 481775 some people don't want to run daily jobs at all, if they - didn't run in specific time f.e. 4-7 hours. -- 470168 random delay was removed from crontabs and added into - anacron, where could be better set. -- cron.d/0hourly will every hour run cron.hourly/0anacron which - check whether the jobs should be running or not - -* Thu Jan 28 2009 Marcela Mašláňová 2.3-67 -- 482782 output in init script redirected - -* Mon Jan 26 2009 Marcela Mašláňová 2.3-66 -- cron.{daily,weekly,hourly,monthly} should be owned by crontabs, because - some don't have installed anacron and other cron like programmes could - be dependent -- 0anacron is now trying run all cron.{daily,weekly,...} every hour. - This should fix problem with jobs running twice, with not running jobs - after hibernation and so on. -- the random delay is in default switch off - -* Fri Oct 24 2008 Marcela Mašláňová 2.3-65 -- rewrite init script - using fedora guidelines SysVInitScript - -* Wed Jul 30 2008 Marcela Maslanova 2.3-64 -- fix fuzz -- fix previous patch, thanks to mbroz - -* Wed Jul 30 2008 Marcela Maslanova 2.3-62 -- 441576 really stop anacron daemon - -* Wed May 28 2008 Marcela Maslanova 2.3-61 -- cleaning lots of scripts in anacron & crontabs - -* Wed Apr 9 2008 Marcela Maslanova 2.3-60 -- correct spooldir logged - -* Thu Feb 28 2008 Marcela Maslanova 2.3-59 -- 0anacron.{daily,weekly,monthly} sterror's output also goes to dev/null -- rhbz#435255 - -* Tue Feb 19 2008 Fedora Release Engineering - 2.3-58 -- Autorebuild for GCC 4.3 - -* Mon Dec 10 2007 Marcela Maslanova 2.3-57 -- 0anacron.{daily,weekly,monthly} check whether they are on battery -- rhbz#387301 - -* Tue Sep 25 2007 Marcela Maslanova 2.3-56 -- cron.{hourly,daily} work correct -> remove checking whether - cron.daily has been run -- persist: run pc between midnight and 4:02 -> cron.daily run twice. -- rhbz#296741 - -* Fri Aug 31 2007 Marcela Maslanova 2.3-55 -- change chkconfig --add, because it wasn't running after - fresh install #267801 - -* Thu Aug 30 2007 Marcela Maslanova 2.3-54 -- change chkconfig levels in post part - -* Wed Aug 17 2007 Marcela Maslanova 2.3-53 -- rebuild with changed post - starting value must be removed -- Resolves: 252166, 252255, 252254 - -* Tue Aug 14 2007 Marcela Maslanova 2.3-51 -- rebuild with correct init script - -* Mon Aug 13 2007 Marcela Maslanova 2.3-50 -- rewrite typo in init script -- Resolves: rhbz#251757 - -* Wed Aug 08 2007 Marcela Maslanova 2.3-49 -- adopt some patches from upstream for better locking -- add own changes, which resolve problem with two or more run of - cron.daily per day. -- Resolves: #157448 - -* Wed Jul 11 2007 Marcela Maslanova 2.3-48 -- changes in init script (not build) - -* Tue Feb 6 2007 Marcela Maslanova 2.3-47 -- thanks for review from Jef Spaleta -- rhbz#225247, rhbz#211309 - -* Mon Dec 04 2006 Marcela Maslanova 2.3-45 -- rebuilt with pie insted pic - -* Tue Oct 10 2006 Marcela Maslanova 2.3-44 -- fix memory leaking (both #210020) -- PIE(PIC) executable - -* Tue Oct 2 2006 Marcela Maslanova 2.3-42 -- hostname added to mail (#208914) - -* Fri Sep 29 2006 Marcela Maslanova 2.3-41 -- change spec file - patch from Orion Poplawski (#191410) - -* Mon Sep 11 2006 Dan Walsh 2.3-40 -- Grab the fdclose patch from FC4 -- fix bug 185973: allow use of sendmail under selinux-policy-strict: - apply patch contributed by Ted Rule - -* Wed Aug 30 2006 Jitka Kudrnacova - 2.3-39 -- modified PATH in /etc/anacrontab file to make the same as in /etc/crontab (#61891) - -* Wed Jul 12 2006 Jesse Keating - 2.3-38.FC6.1 -- rebuild - -* Thu Apr 13 2006 Jason Vas Dias - 2.3-38.1 -- fix bug 188403: anacron SysVinit locking: - Since anacron just exits when it has no more work to do, the - initscript cannot do normal /var/lock/subsys/anacron lock file - creation, else messages such as 'anacron dead but subsys locked' - will appear when changing init levels. - - Now, the anacron process itself creates its own - /var/lock/subsys/anacron SysVinit lock file and - /var/run/anacron.pid pid file to co-operate more - gracefully with the initscript system. - -* Fri Feb 10 2006 Jesse Keating - 2.3-36.1 -- bump again for double-long bug on ppc(64) - -* Tue Feb 07 2006 Jason Vas Dias - 2.3-36 -- rebuild for new gcc, glibc, glibc-kernheaders - -* Wed Jan 11 2006 Peter Jones 2.3-35 -- Fix initscript so changing runlevel shuts it down correctly - -* Fri Dec 09 2005 Jesse Keating -- rebuilt - -* Wed Mar 16 2005 Jason Vas Dias 2.3-34 -- Rebuild with gcc4 in FC4. - -* Mon Feb 21 2005 Jason Vas Dias 2.3-33 -- Rebuild for FC4 . - -* Tue Sep 28 2004 Rik van Riel 2.3-32 -- add MAILTO option, like vixie cron has (bz#127924) - -* Fri Jul 2 2004 Elliot Lee -- rebuilt -- Add noconst patch to fix invalid C - -* Fri Feb 13 2004 Elliot Lee -- rebuilt - -* Thu Jul 10 2003 Jens Petersen - 2.3-29 -- don't require vixie-cron (#21176) [reported by Gerald Teschl] -- in init script don't remove /var/lock/subsys/anacron when stopping (#58462) -- exit init script with actual exit status (#44600) [reported by Enrico Scholz] - -* Thu Jul 10 2003 Jens Petersen - 2.3-28 -- add a Content-Type header to mails giving the charset encoding (#77108) - -* Thu Jul 10 2003 Jens Petersen - 2.3-27 -- in init script do not touch /var/lock/subsys/anacron when starting (#58462) -- require crontabs (#21176) -- update source url - -* Wed Jun 04 2003 Elliot Lee -- rebuilt - -* Wed Jan 22 2003 Tim Powers -- rebuilt - -* Wed Dec 11 2002 Tim Powers 2.3-24 -- rebuild on all arches - -* Fri Aug 23 2002 Jens Petersen 2.3-23 -- delay the start of anacron by 60min to make startup more pleasant (#68304) -- at startup run jobs serially and nice 19 to reduce load (#65870, #68304) -- spec file now in utf-8 -- dont install non-existant NEWS file -- silence make include warnings - -* Fri Jul 19 2002 Akira TAGOH 2.3-22 -- fix the stripped binary issue. - -* Mon Jul 08 2002 Bill Huang -- Update "Copyright" to "License" in spec file - -* Fri Jun 21 2002 Tim Powers -- automated rebuild - -* Thu May 23 2002 Tim Powers -- automated rebuild - -* Wed Jan 09 2002 Tim Powers -- automated rebuild - -* Sun Jun 24 2001 Elliot Lee -- Bump release + rebuild. - -* Tue Apr 3 2001 Crutcher Dunnavant -- add dependancy to vixie-cron (for /usr/bin/run-parts) - -* Tue Feb 13 2001 Tim Waugh -- killproc is a shell function and can't be passed as a parameter - (bug #27150). - -* Mon Feb 5 2001 Bernhard Rosenkraenzer -- Fix i18n in initscript ("Stopping anacron" wasn't translated) - (#26076) - -* Fri Feb 2 2001 Trond Eivind Glomsrød -- i18nize initscript - -* Thu Dec 7 2000 Crutcher Dunnavant -- rebuild in rebuild cycle. - -* Mon Oct 30 2000 Matt Wilson -- touch /var/lock/subsys/anacron to prevent excess startage during - init level change - -* Wed Aug 30 2000 Bernhard Rosenkraenzer -- Shut down earlier to prevent NFS mounted /usr filesystems from causing - problems (Bug #16257) - -* Fri Aug 4 2000 Bernhard Rosenkraenzer -- Start it later so services some cron scripts may depend on are running - (Bug #15335) - -* Thu Aug 3 2000 Bernhard Rosenkraenzer -- Fix up initscript (Bug #15123 and an unreported bug) - -* Sat Jul 15 2000 Bill Nottingham -- move initscript back - -* Wed Jul 12 2000 Prospector -- automatic rebuild - -* Mon Jul 10 2000 Bernhard Rosenkraenzer -- Fix up initscripts (Bug #13625) - -* Tue Jul 4 2000 Matt Wilson -- Prereq: /sbin/chkconfig - -* Mon Jun 26 2000 Preston Brown -- move initscript to /etc/init.d, fix up post/preun/postun scripts. - -* Sun Jun 26 2000 Bernhard Rosenkraenzer -- 2.3 - -* Sun Jun 18 2000 Matt Wilson -- use %%{_mandir} - -* Fri Mar 03 2000 Tim Powers -- fixed startup script so that it doesn't put stuff in /var/lock/subsys. - Complains since anacronda turns itself off when it is run, and the file in - /var/lock/subsys isn't removed. - -* Mon Feb 28 2000 Tim Powers -- fixed startup script, now it actually stops, gives status and restarts. - Fixes bug #9835 - -* Mon Feb 7 2000 Bill Nottingham -- handle compressed manpages - -* Fri Feb 4 2000 Bernhard Rosenkraenzer -- rebuild to get compressed man pages -- mark /etc/cron.daily/... as config files - -* Wed Feb 02 2000 Cristian Gafton -- fix annoying defines -- rebuild to update description and group - -* Thu Jan 6 2000 Bernhard Rosenkränzer -- initial Red Hat package - -* Wed Dec 29 1999 Chmouel Boudjnah -- Remove cron.hourly check (unusefull). - -* Wed Nov 10 1999 Chmouel Boudjnah -- 2.1 from debian. -- Fix typo in initscripts. - -* Thu Jul 22 1999 Chmouel Boudjnah -- Fix wrong entries in anacrontab. -- Add a /etc/rc.sysinit/ script - -* Tue Apr 27 1999 Chmouel Boudjnah -- Fix bug with /var/spool/anacron/ - -* Sat Apr 10 1999 Chmouel Boudjnah -- First version mainly inspired from the Debian package. diff --git a/anacron_2.3-13.patch b/anacron_2.3-13.patch deleted file mode 100644 index 0a36015..0000000 --- a/anacron_2.3-13.patch +++ /dev/null @@ -1,1630 +0,0 @@ ---- anacron-2.3.orig/ChangeLog -+++ anacron-2.3/ChangeLog -@@ -1,3 +1,8 @@ -+ Changes in Anacron 2.3.1 -+ ------------------------ -+* documentation no longer suggests adding local directories to the PATH -+ -+ - Changes in Anacron 2.3 - ---------------------- - * anacron can now read an arbitrary anacrontab file, use the -t option ---- anacron-2.3.orig/README -+++ anacron-2.3/README -@@ -40,7 +40,7 @@ - off for the night or for the weekend, these scripts rarely get run. - - Anacron solves this problem. These jobs can simply be scheduled as --Anacron-jobs with periods of 1, 7 and 30 days. -+Anacron-jobs with periods of 1, 7 and a special target called @monthly. - - - What Anacron is not ? -@@ -109,11 +109,11 @@ - -----Cut - # /etc/anacrontab example - SHELL=/bin/sh --PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -+PATH=/sbin:/bin:/usr/sbin:/usr/bin - # format: period delay job-identifier command - 1 5 cron.daily run-parts /etc/cron.daily - 7 10 cron.weekly run-parts /etc/cron.weekly --30 15 cron.monthly run-parts /etc/cron.monthly -+@monthly 15 cron.monthly run-parts /etc/cron.monthly - -----Cut - - 5. Put the command "anacron -s" somewhere in your boot-scripts. ---- anacron-2.3.orig/TODO -+++ anacron-2.3/TODO -@@ -1,6 +1,3 @@ --anacron runs jobs twice in a 31 day month --add hostname to emails sent to admin --allow user anacrontabs - make manpages match #defines automagically --> sed fu - full ANSI / POSIX compliance - code cleaning ---- anacron-2.3.orig/anacron.8 -+++ anacron-2.3/anacron.8 -@@ -1,13 +1,15 @@ --.TH ANACRON 8 2000-06-22 "Sean 'Shaleh' Perry" "Anacron Users' Manual" -+.TH ANACRON 8 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" - .SH NAME - anacron \- runs commands periodically - .SH SYNOPSIS - .B anacron \fR[\fB-s\fR] [\fB-f\fR] [\fB-n\fR] [\fB-d\fR] [\fB-q\fR] --[\fB-t anacrontab\fR] [\fIjob\fR] ... -+[\fB-t anacrontab\fR] [\fB-S spooldir\fR] [\fIjob\fR] ... - .br --.B anacron -u [\fB-t anacrontab\fR] \fR[\fIjob\fR] ... -+.B anacron [\fB-S spooldir\fR] -u [\fB-t anacrontab\fR] \fR[\fIjob\fR] ... - .br - .B anacron \fR[\fB-V\fR|\fB-h\fR] -+.br -+.B anacron -T [\fB-t anacrontab\fR] - .SH DESCRIPTION - Anacron - can be used to execute commands periodically, with a -@@ -58,7 +60,10 @@ - completely independent. - .PP - If a job generates any output on its standard output or standard error, --the output is mailed to the user running Anacron (usually root). -+the output is mailed to the user running Anacron (usually root), or to -+the address contained by the MAILTO environment variable in the crontab, if such -+exists. If the LOGNAME environment variable is set, it will be used as From: -+field. - .PP - Informative messages about what Anacron is doing are sent to \fBsyslogd(8)\fR - under facility \fBcron\fR, priority \fBnotice\fR. Error messages are sent at -@@ -98,6 +103,15 @@ - .B -t anacrontab - Use specified anacrontab, rather than the default - .TP -+.B -T -+Anacrontab testing. The configuration file will be tested for validity. If -+there is an error in the file, an error will be shown and anacron will -+return 1. Valid anacrontabs will return 0. -+.TP -+.B -S spooldir -+Use the specified spooldir to store timestamps in. This option is required for -+users who wish to run anacron themselves. -+.TP - .B -V - Print version information, and exit. - .TP -@@ -115,6 +129,8 @@ - file. See - .B tzset(3) - for more information. -+ -+Timestamp files are created in the spool directory for each job in anacrontab. These are never removed automatically by anacron, and should be removed by hand if a job is no longer being scheduled. - .SH FILES - .TP - .I /etc/anacrontab -@@ -144,4 +160,7 @@ - The current implementation is a complete rewrite by Itai Tzur - . - .PP --The code base is currently maintained by Sean 'Shaleh' Perry . -+The code base was maintained by Sean 'Shaleh' Perry . -+.PP -+Since 2004, it is maintained by Pascal Hakim . -+ ---- anacron-2.3.orig/anacron.apm -+++ anacron-2.3/anacron.apm -@@ -0,0 +1,19 @@ -+#! /bin/sh -+ -+# This script makes anacron jobs start to run when the machine is -+# plugged into AC power, or woken up. For a laptop, these are the -+# closest parallels to turning on a desktop. -+ -+# The /etc/init.d/anacron script now normally tries to avoid running -+# anacron unless on AC power, so as to avoid running down the battery. -+# (Things like the slocate updatedb cause a lot of IO.) Rather than -+# trying to second-guess which events reflect having or not having -+# power, we just try to run anacron every time and let it abort if -+# there's no AC. You'll see a message on the cron syslog facility -+# (typically /var/log/cron) if it does run. -+ -+case "$1,$2" in -+change,power|resume,*) -+ /etc/init.d/anacron start >/dev/null -+ ;; -+esac ---- anacron-2.3.orig/anacrontab.5 -+++ anacron-2.3/anacrontab.5 -@@ -1,4 +1,4 @@ --.TH ANACRONTAB 5 1998-02-02 "Itai Tzur" "Anacron Users' Manual" -+.TH ANACRONTAB 5 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" - .SH NAME - /etc/anacrontab \- configuration file for anacron - .SH DESCRIPTION -@@ -8,10 +8,13 @@ - three kinds: job-description lines, environment - assignments, or empty lines. - .PP --Job-description lines are of the form: -+Job-description lines are of one of these two forms: - .PP - period delay job-identifier command - .PP -+.PP -+ @period_name delay job-identify command -+.PP - The - .I period - is specified in days, the -@@ -22,7 +25,12 @@ - the job in Anacron messages, - and as the name for the job's timestamp file. The - .I command --can be any shell command. -+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. - .PP - Environment assignment lines are of the form: - .PP -@@ -38,6 +46,8 @@ - .PP - Empty lines are either blank lines, line containing white-space only, or - lines with white-space followed by a '#' followed by an arbitrary comment. -+.PP -+You can continue a line onto the next line by ending it with a '\'. - .SH "SEE ALSO" - .B anacron(8) - .PP -@@ -46,3 +56,5 @@ - file. - .SH AUTHOR - Itai Tzur -+.PP -+Currently maintained by Pascal Hakim . ---- anacron-2.3.orig/debian/0anacron.daily -+++ anacron-2.3/debian/0anacron.daily -@@ -0,0 +1,12 @@ -+#!/bin/sh -+# -+# anacron's cron script -+# -+# This script updates anacron time stamps. It is called through run-parts -+# either by anacron itself or by cron. -+# -+# The script is called "0anacron" to assure that it will be executed -+# _before_ all other scripts. -+ -+test -x /usr/sbin/anacron || exit 0 -+anacron -u cron.daily ---- anacron-2.3.orig/debian/0anacron.monthly -+++ anacron-2.3/debian/0anacron.monthly -@@ -0,0 +1,12 @@ -+#!/bin/sh -+# -+# anacron's cron script -+# -+# This script updates anacron time stamps. It is called through run-parts -+# either by anacron itself or by cron. -+# -+# The script is called "0anacron" to assure that it will be executed -+# _before_ all other scripts. -+ -+test -x /usr/sbin/anacron || exit 0 -+anacron -u cron.monthly ---- anacron-2.3.orig/debian/0anacron.weekly -+++ anacron-2.3/debian/0anacron.weekly -@@ -0,0 +1,12 @@ -+#!/bin/sh -+# -+# anacron's cron script -+# -+# This script updates anacron time stamps. It is called through run-parts -+# either by anacron itself or by cron. -+# -+# The script is called "0anacron" to assure that it will be executed -+# _before_ all other scripts. -+ -+test -x /usr/sbin/anacron || exit 0 -+anacron -u cron.weekly ---- anacron-2.3.orig/debian/compat -+++ anacron-2.3/debian/compat -@@ -0,0 +1 @@ -+4 ---- anacron-2.3.orig/debian/anacrontab -+++ anacron-2.3/debian/anacrontab -@@ -0,0 +1,12 @@ -+# /etc/anacrontab: configuration file for anacron -+ -+# See anacron(8) and anacrontab(5) for details. -+ -+SHELL=/bin/sh -+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -+ -+# These replace cron's entries -+1 5 cron.daily nice run-parts --report /etc/cron.daily -+7 10 cron.weekly nice run-parts --report /etc/cron.weekly -+@monthly 15 cron.monthly nice run-parts --report /etc/cron.monthly -+ ---- anacron-2.3.orig/debian/apm.d -+++ anacron-2.3/debian/apm.d -@@ -0,0 +1,19 @@ -+#! /bin/sh -+ -+# This script makes anacron jobs start to run when the machine is -+# plugged into AC power, or woken up. For a laptop, these are the -+# closest parallels to turning on a desktop. -+ -+# The /etc/init.d/anacron script now normally tries to avoid running -+# anacron unless on AC power, so as to avoid running down the battery. -+# (Things like the slocate updatedb cause a lot of IO.) Rather than -+# trying to second-guess which events reflect having or not having -+# power, we just try to run anacron every time and let it abort if -+# there's no AC. You'll see a message on the cron syslog facility -+# (typically /var/log/cron) if it does run. -+ -+case "$1,$2" in -+change,power|resume,*) -+ /usr/sbin/invoke-rc.d anacron start >/dev/null -+ ;; -+esac ---- anacron-2.3.orig/debian/init.d -+++ anacron-2.3/debian/init.d -@@ -0,0 +1,48 @@ -+#! /bin/sh -+# /etc/init.d/anacron: start anacron -+# -+ -+PATH=/bin:/usr/bin:/sbin:/usr/sbin -+ -+test -x /usr/sbin/anacron || exit 0 -+ -+. /lib/lsb/init-functions -+ -+case "$1" in -+ start) -+ log_daemon_msg "Starting anac(h)ronistic cron" "anacron" -+ if test -x /usr/bin/on_ac_power -+ then -+ /usr/bin/on_ac_power >/dev/null -+ if test $? -eq 1 -+ then -+ log_progress_msg "deferred while on battery power." -+ log_end_msg 0 -+ exit 0 -+ fi -+ fi -+ -+ # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) -+ # or on_ac_power returns 255 (undefined, desktop machine without APM) -+ start-stop-daemon --start --exec /usr/sbin/anacron -- -s -+ log_end_msg 0 -+ ;; -+ restart|force-reload) -+ # nothing to do -+ : -+ ;; -+ stop) -+ log_daemon_msg "Stopping anac(h)ronistic cron" "anacron" -+ start-stop-daemon --stop --exec /usr/sbin/anacron --oknodo --quiet -+ log_end_msg 0 -+ ;; -+ status) -+ exit 4 -+ ;; -+ *) -+ echo "Usage: /etc/init.d/anacron {start|stop}" -+ exit 2 -+ ;; -+esac -+ -+exit 0 ---- anacron-2.3.orig/debian/control -+++ anacron-2.3/debian/control -@@ -0,0 +1,27 @@ -+Source: anacron -+Section: admin -+Priority: optional -+Build-Depends: debhelper (>= 4.0) -+Maintainer: Pascal Hakim -+Standards-Version: 3.7.2 -+ -+Package: anacron -+Architecture: any -+Depends: ${shlibs:Depends}, debianutils (>= 1.7), ${misc:Depends}, lsb-base (>= 3.0-10) -+Replaces: pe -+Recommends: cron (>= 3.0pl1-43), exim4 | mail-transport-agent, sysklogd | system-log-daemon -+Suggests: powermgmt-base -+Description: cron-like program that doesn't go by time -+ Anacron (like `anac(h)ronistic') is a periodic command scheduler. It -+ executes commands at intervals specified in days. Unlike cron, it -+ does not assume that the system is running continuously. It can -+ therefore be used to control the execution of daily, weekly and -+ monthly jobs (or anything with a period of n days), on systems that -+ don't run 24 hours a day. When installed and configured properly, -+ Anacron will make sure that the commands are run at the specified -+ intervals as closely as machine-uptime permits. -+ . -+ This package is pre-configured to execute the daily jobs of the Debian -+ system. You should install this program if your system isn't powered on -+ 24 hours a day to make sure the maintenance jobs of other Debian packages -+ are executed each day. ---- anacron-2.3.orig/debian/copyright -+++ anacron-2.3/debian/copyright -@@ -0,0 +1,26 @@ -+ -+This is the Debian Linux prepackaged version of the anacron utility. -+ -+ Anacron - run commands periodically -+ Copyright (C) 1998 Itai Tzur -+ Copyright (C) 1999 Sean 'Shaleh' Perry -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., 51 -+ Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ -+ -+anacron can be found on http://www.sourceforge.net. -+ -+On Debian Linux systems, the complete text of the GNU General -+Public License can be found in `/usr/share/common-licenses/GPL'. ---- anacron-2.3.orig/debian/cron.d -+++ anacron-2.3/debian/cron.d -@@ -0,0 +1,6 @@ -+# /etc/cron.d/anacron: crontab entries for the anacron package -+ -+SHELL=/bin/sh -+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -+ -+30 7 * * * root test -x /etc/init.d/anacron && /usr/sbin/invoke-rc.d anacron start >/dev/null ---- anacron-2.3.orig/debian/dirs -+++ anacron-2.3/debian/dirs -@@ -0,0 +1,11 @@ -+etc/cron.d -+etc/init.d -+etc/cron.daily -+etc/cron.weekly -+etc/cron.monthly -+etc/apm/event.d -+usr/sbin -+usr/share/doc/anacron -+usr/share/man/man5 -+usr/share/man/man8 -+var/spool/anacron ---- anacron-2.3.orig/debian/docs -+++ anacron-2.3/debian/docs -@@ -0,0 +1 @@ -+README TODO ---- anacron-2.3.orig/debian/rules -+++ anacron-2.3/debian/rules -@@ -0,0 +1,69 @@ -+#!/usr/bin/make -f -+# Made with the aid of dh_make, by Craig Small -+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. -+# Some lines taken from debmake, by Cristoph Lameter. -+ -+# Uncomment this to turn on verbose mode. -+#export DH_VERBOSE=1 -+ -+build: build-stamp -+build-stamp: -+ dh_testdir -+ -+ $(MAKE) -+ -+ touch build-stamp -+ -+clean: -+ dh_testdir -+ dh_testroot -+ rm -f build-stamp install-stamp -+ -+ -$(MAKE) clean -+ -+ dh_clean -+ -+install: install-stamp -+install-stamp: build-stamp -+ dh_testdir -+ dh_testroot -+ dh_clean -k -+ dh_installdirs -+ -+ $(MAKE) install PREFIX=debian/anacron MANDIR=debian/anacron/usr/share/man -+ install -m 644 debian/anacrontab debian/anacron/etc/ -+ install debian/0anacron.daily debian/anacron/etc/cron.daily/0anacron -+ install debian/0anacron.weekly debian/anacron/etc/cron.weekly/0anacron -+ install debian/0anacron.monthly debian/anacron/etc/cron.monthly/0anacron -+ install -m 755 debian/apm.d debian/anacron/etc/apm/event.d/anacron -+ -+ touch install-stamp -+ -+# Build architecture-independent files here. -+binary-indep: build install -+# We have nothing to do -+ -+# Build architecture-dependent files here. -+binary-arch: build install -+ dh_testdir -+ dh_testroot -+ dh_installdocs -+ dh_installinit -u"start 89 2 3 4 5 . stop 11 0 1 6 ." -+ dh_installcron -+ dh_installman -+ dh_installchangelogs ChangeLog -+ #dh_installdebconf -+ dh_strip -+ dh_compress -+ dh_fixperms -+ dh_installdeb -+ dh_shlibdeps -+ dh_gencontrol -+ dh_md5sums -+ dh_builddeb -+ -+source diff: -+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false -+ -+binary: binary-indep binary-arch -+.PHONY: build clean binary-indep binary-arch binary ---- anacron-2.3.orig/debian/anacron.postinst -+++ anacron-2.3/debian/anacron.postinst -@@ -0,0 +1,18 @@ -+#!/bin/sh -+ -+case "$1" in -+ configure) -+ # continue below -+ ;; -+ -+ abort-upgrade|abort-remove|abort-deconfigure) -+ exit 0 -+ ;; -+ -+ *) -+ echo "postinst called with unknown argument \`$1'" >&2 -+ exit 0 -+ ;; -+esac -+ -+#DEBHELPER# ---- anacron-2.3.orig/debian/changelog -+++ anacron-2.3/debian/changelog -@@ -0,0 +1,471 @@ -+anacron (2.3-13) unstable; urgency=medium -+ -+ * Remove debconf remnant -+ (Closes: #392253) -+ -+ -- Pascal Hakim Sat, 14 Oct 2006 18:47:00 +1000 -+ -+anacron (2.3-12) unstable; urgency=medium -+ -+ * Removed debconf note as it's really not needed anymore. Thanks to all the -+ people who did translations. -+ - Removed un-needed debconf note -+ (Closes: #388703) -+ - Arabic (Ossama M. Khayat ) -+ (Closes: #320761) -+ - Danish (Claus Hindsgaul ) -+ - Dutch (Frans Pop ) -+ (Closes: #374267) -+ - German (Erik Schanze ) -+ - Italian (Luca Monducci ) -+ (Closes: #375411) -+ - Portuguese (Miguel Figueiredo ) -+ (Closes: #336839) -+ - Russian (Yuriy Talakan ) -+ (Closes: #310069) -+ - Spanish (Lucas Wall ) -+ (Closes: #374312) -+ - Swedish (Daniel Nylander ) -+ (Closes: #331300) -+ - Vietnamese (Clytie Siddall ) -+ (Closes: #307740) -+ * Fixed description to not have a leading particle -+ (Closes: #320303) -+ * Start anacron properly on bootup using start-stop-daemon to ensure -+ automated installers work properly -+ (Closes: #310797) -+ * Clarified README.Debian to make more sense and match what's going on -+ (Closes: #307114) -+ * Added alternate dependency on debconf-2.0 -+ (as per <20050802224620.GB12557@kitenet.net>) -+ (Closes: #331739) -+ * Changed default path to the default cron one to reduce confusion -+ (Closes: #304327) -+ * Bumped up the debhelper compability version to 4 -+ * Bumped standards version to 3.7.2 -+ * Cleaned up debian/ -+ * Added { and } to the Usage line to make bash competition work -+ (Closes: #350603) -+ * Added a note about timestamp files in the spool directory in the man -+ page. -+ (Closes: #305424) -+ * Fixed substition in debconf template, and make escape it properly -+ (Closes: #366850) -+ * Test whether anacron is executable, not just present -+ (Closes: #378380) -+ * Make anacron have an lsb-compliant init.d script -+ (Closes: #384689) -+ -+ -- Pascal Hakim Mon, 09 Oct 2006 18:47:00 +1000 -+ -+anacron (2.3-11) unstable; urgency=low -+ -+ * Added @yearly target in anacrontab. -+ (Closes: #258617) -+ * Let an anacrontabs be multiline -+ (Closes: #215684) -+ * Remove dependency on an MTA (it's a recommend instead) -+ (Closes: #252633) -+ * Remove dependency on syslog (recommend as well) -+ (Closes: #252633) -+ * Fix the kill sysvinit invocations -+ (Closes: #289547) -+ -+ -- Pascal Hakim Wed, 9 Feb 2005 08:08:00 +1100 -+ -+anacron (2.3-10) unstable; urgency=low -+ -+ * Changed current maintainer in documentation -+ (Closes: #256590) -+ * Added precisions to @monthly usage in anacrontab (5). -+ (Closes: #256590) -+ * Fixed a printf segfault when DEBUG mode is enabled -+ (Thanks to Martin Quinson ) -+ (Closes: #257669) -+ * Added two variables to change the ability to change the -+ destination and source emails for anacron emails -+ (Thanks to Martin Quinson ) -+ (Closes: #223337) -+ * Translations: -+ + Updated German (Erik Schanze ) -+ (Closes: #250293) -+ + Added Brazilian Portuguese (Andre Luis Lopes ) -+ (Closes: #254107) -+ + Added Spanish (Lucas Wall ) -+ (Closes: #254559) -+ + Addedd Czech (Jan Outrata ) -+ -+ -- Pascal Hakim Sun, 11 Jul 2004 04:52:00 +1000 -+ -+anacron (2.3-9) unstable; urgency=low -+ -+ * Fixed priority -+ * Added translations -+ + Danish from Claus Hindsgaul -+ (Closes: #242814) -+ + Japanese from Hideki Yamane -+ (Closes: #243268) -+ + Italian from Luca Monducci -+ (Closes: #249072) -+ + German from Erik Schanze -+ (Closes: #250293) -+ + Dutch from Luk Claes -+ (Closes: #250657) -+ * Added an option to check the validity of the config file. -+ (Closes: #248692) -+ * Make the -t option work with non-absolute path names. -+ * Added an extra anacrontab entry (@monthly) which can be used to -+ schedule a job to run once a month. -+ (Closes: #35754, #43947) -+ * Add the ability for normal users to run anacron by specifying a -+ spool directory. -+ (Closes: #65853) -+ -+ -- Pascal Hakim Mon, 31 May 2004 23:30:00 +1000 -+ -+anacron (2.3-8) unstable; urgency=low -+ -+ * New maintainer. A side effect of this will be to fix the email alias. -+ (Closes: #215685) -+ * Updated to standard versions 3.6.1.0 -+ + Rebuild fixes /usr/share/doc symlink -+ (Closes: #224559) -+ * Fixed FTBFS bug. -+ (Closes: #240043) -+ * Added powermgmt-base to Suggests. -+ (Closes: #137435, #140912) -+ * Fixed up README.Debian to remove a missing example. That example is now -+ included by default, as anacron will check the power status. -+ (Closes: #181034) -+ * Added debconf-isation. -+ (Patch from Martin Quinson ) -+ (closes: #134017) -+ * Fixed grammar mistake. -+ (Patch from Julian Gilbey ) -+ (Closes: #184649) -+ * Use invoke-rc.d instead of calling the init.d script directly -+ (Closes: #187544) -+ * Clarified documentation in respect to tabs and spaces in anacrontab(5). -+ (Closes: #214314) -+ * Include hostname in mail subject -+ (Patch from Martin Quinson ) -+ (Closes: #63543, #45149) -+ * Make the From field in mails RFC2822-compliant -+ (Patch from Santiago Villa ) -+ (Closes: #163083) -+ * Update depency on exim to exim4, which is the new standard mailer -+ (Closes: #228571) -+ * Make "/etc/init.d/anacron stop" try to stop anacron -+ (Closes: #97969) -+ -+ -- Pascal Hakim Thu, 01 Apr 2004 21:30:00 +1000 -+ -+anacron (2.3-7) unstable; urgency=high -+ -+ * forgive the delay all, life has been hectic -+ * urgency is high because anacron no longer works if on_ac_power is missing. -+ This was caused by the reshuffled of on_ac_power into powermgmt-base which -+ I did not believe was going into Woody. -+ * fixed the init.d script so it works if on_ac_power is not installed, -+ Closes: #140911 (and a few more via merge) -+ * postrm deletes /var/spool/anacron, Closes: #102638 -+ -+ -- Sean 'Shaleh' Perry Tue, 11 Jun 2002 08:20:46 -0700 -+ -+anacron (2.3-6) unstable; urgency=low -+ -+ * update Standards version -+ -+ -- Sean 'Shaleh' Perry Thu, 29 Mar 2001 17:33:32 -0800 -+ -+anacron (2.3-5) unstable; urgency=low -+ -+ * Duh, left off half the patch, Closes: #83334 -+ -+ -- Sean 'Shaleh' Perry Sun, 4 Feb 2001 10:35:01 -0800 -+ -+anacron (2.3-4) unstable; urgency=low -+ -+ * Added apm event -+ * init.d script now checks whether machine is on battery power (via APM) -+ before starting. This saves jobs like slocate from running when you start -+ your laptop on a place. Code used submitted by Martin Pool. -+ Closes: #83334 -+ * now that I ship an apm event, I removed the example -+ -+ -- Sean 'Shaleh' Perry Thu, 25 Jan 2001 10:05:23 -0800 -+ -+anacron (2.3-3) unstable; urgency=low -+ -+ * Removed local dirs from default anacrontab -+ * Changed to depeds from syslog to syslog | system-log-daemon -+ -+ -- Sean 'Shaleh' Perry Wed, 18 Oct 2000 07:41:27 -0700 -+ -+anacron (2.3-2) unstable; urgency=low -+ -+ * Oops, forgot a '.' -+ * Closes: #66161 -+ -+ -- Sean 'Shaleh' Perry Sat, 24 Jun 2000 11:45:15 -0700 -+ -+anacron (2.3-1) unstable; urgency=low -+ -+ * New release -+ -+ -- Sean 'Shaleh' Perry Thu, 22 Jun 2000 16:02:42 -0700 -+ -+anacron (2.2-2) unstable; urgency=low -+ -+ * Fixed clock skew check -+ * anacron is now on sourceforge.net -+ * anacron installs init at S89, not S20 as before. This is to match cron. -+ * Closes: #63146, #65785, #65923 -+ -+ -- Sean 'Shaleh' Perry Thu, 22 Jun 2000 14:18:41 -0700 -+ -+anacron (2.2-1) unstable; urgency=low -+ -+ * maintainer upload -+ * Closes: #57286, #65436, #61417, #64599 -+ * Torsten, thanks, you caught me the one time I was away from my desk (-: -+ -+ -- Sean 'Shaleh' Perry Tue, 13 Jun 2000 13:19:12 -0700 -+ -+anacron (2.1-5.1) frozen unstable; urgency=low -+ -+ * Non maintainer upload. Shaleh, please forgive me, but this is a -+ really small change and I would really hate to see reports that -+ the installation does not work because of broken task packages... -+ * [RC] Name exim as solution for mail-transport-agent in Depends line. -+ Otherwise tasksel will break on the task-dialup package (closes: #64599). -+ * I'm dumb - uploaded to unstable only *sigh* -+ -+ -- Torsten Landschoff Thu, 25 May 2000 20:08:37 +0200 -+ -+anacron (2.1-5) unstable; urgency=low -+ -+ * updates for recent policy -+ * Closes: #50255 -+ -+ -- Sean E. Perry Thu, 21 Nov 1999 22:17:33 -0800 -+ -+anacron (2.1-4) unstable; urgency=low -+ -+ * Closes: #45954 -+ -+ -- Sean E. Perry Wed, 29 Sep 1999 11:20:12 -0700 -+ -+anacron (2.1-3) unstable; urgency=low -+ -+ * Real FHS compliance -+ * Closes: #33828, #34851, #39841, #43047, #44083, #44889 -+ -+ -- Sean E. Perry Mon, 20 Sep 1999 15:28:37 -0700 -+ -+anacron (2.1-2) unstable; urgency=low -+ -+ * Upload for fhs compliance -+ -+ -- Sean E. Perry Tue, 7 Sep 1999 14:26:00 -0700 -+ -+anacron (2.1-1) unstable; urgency=low -+ -+ * New release -+ -+ -- Sean E. Perry Thu, 12 Aug 1999 12:23:37 -0700 -+ -+anacron (2.0.1-5) unstable; urgency=low -+ -+ * D'uh, closes #37344, learn to type Sean (-: -+ -+ -- Sean E. Perry Sun, 9 May 1999 00:21:22 -0400 -+ -+anacron (2.0.1-4) unstable; urgency=low -+ -+ * check for anacron's existence in conffiles -+ * clean up in rules file -+ -+ -- Sean E. Perry Thu, 6 May 1999 23:19:45 -0400 -+ -+anacron (2.0.1-3) unstable; urgency=low -+ -+ * New maintainer (finally) -+ * begin clean mode -+ * removed rc?.d/K20anacron scripts, they were useless -+ * switched to debhelper -+ * closes: 23258 -+ * closes: 24555 -+ * closes: 26612 -+ * closes: 32852 -+ -+ -- Sean E. Perry Thu, 25 Mar 1999 12:56:02 -0500 -+ -+anacron (2.0.1-2) frozen unstable; urgency=low -+ -+ * Orphaned package -+ * Incorporated changes from last NMR (fixes:bug#21598) -+ -+ -- Christian Schwarz Thu, 14 May 1998 22:49:30 +0200 -+ -+anacron (2.0.1-1.1) frozen unstable; urgency=low -+ -+ * NMR to correct problems with build not using gcc and trying to install -+ files somewhere other than debian/tmp and not using dpkg-shlibdeps to -+ make sure debian/substvars (which wasn't being deleted during clean) was -+ correct (fixes:bug#21598) -+ -+ -- Michael Alan Dorman Sun, 10 May 1998 11:03:33 +0500 -+ -+anacron (2.0.1-1) frozen unstable; urgency=low -+ -+ * New upstream release (contains only bug fixes; fixes:bug#19557) -+ -+ * Recommend "cron (>= 3.0pl1-43)" which does not include the obsolete -+ cronanacron script anymore -+ -+ * Install manual pages with correct file permissions -+ (detected by Lintian) -+ -+ -- Christian Schwarz Sat, 21 Mar 1998 11:03:33 +0100 -+ -+anacron (2.0-3) unstable; urgency=low -+ -+ * Fixed typo in Description (fixes:bug#18875) -+ -+ -- Christian Schwarz Fri, 6 Mar 1998 21:15:48 +0100 -+ -+anacron (2.0-2) unstable; urgency=low -+ -+ * Added "Depends: smail | sendmail | mail-transport-agent" -+ * Don't tag /etc/cron.d/anacron executable (fixes bug #18307) -+ -+ -- Christian Schwarz Tue, 17 Feb 1998 22:49:35 +0100 -+ -+anacron (2.0-1) unstable; urgency=low -+ -+ * New upstream maintainer -+ (Thanks to Itai Tzur for taking over -+ upstream maintenance!) -+ -+ * New upstream version: -+ - anacron has been completely rewritten in C (no perl anymore) -+ - uses flock to lock its lock files (this fixes bug #17550) -+ - uses syslog for logging messages -+ -+ * Register cron job via /etc/cron.d -+ * Updated /etc/cron.*/0anacron* scripts to use `anacron -u' -+ * Modified postinst script to check for existing anacron jobs in -+ /etc/crontab -+ * Changed "Suggests: cron" into "Recommends: cron (>= 3.0pl1-42)" -+ -+ * Added dependency on sysklogd -+ * Removed cron.weekly script to rotate log files -+ -+ * Added new (dummy) options to etc/init.d/anacron: restart, force-reload -+ (reported by Lintian) -+ -+ * Removed buggy prerm script -+ -+ * Updated FSF's address (reported by Lintian) -+ * Updated package description -+ * Added README.Debian to explain Debian specific setup -+ -+ * Built package with fakeroot -+ * Upgraded package to Standards-Version 2.4.0.0 -+ -+ -- Christian Schwarz Mon, 16 Feb 1998 17:19:38 +0100 -+ -+anacron (1.0.7) unstable; urgency=low -+ -+ * debian/rules: Don't use debstd anymore -+ * debian/rules: Compress changelog file (fixes:#15442) -+ * debian/control: Upgraded to Standards Version 2.3.0.1 -+ * debian/control: Removed perl dependency (perl-base is tagged -+ `Essential') -+ -+ -- Christian Schwarz Wed, 24 Dec 1997 13:10:52 +0100 -+ -+anacron (1.0.6) unstable; urgency=low -+ -+ * Handle arguments for postinst (fixes #12572) -+ * Upgraded to Standards Version 2.3.0.0 -+ * Document two more feature requests in the TODO file -+ -+ -- Christian Schwarz Fri, 12 Sep 1997 02:26:17 +0200 -+ -+anacron (1.0.5) unstable; urgency=low -+ -+ * Use little help program to run jobs: this program removes the lockfile -+ even when the job is killed (fixes bug#12060). -+ * Package is now arch-dependent. -+ * postrm: remove log files when purged (fixes bug#12038). -+ * prerm: remove spool files when purged. -+ * Specify /etc/cron.*/*, /etc/init.d/anacron scripts as conffiles. -+ * New file TODO which documents all feature requests: currently bug#11085. -+ * Use debstd in debian/rules . -+ -+ -- Christian Schwarz Mon, 18 Aug 1997 19:31:40 +0200 -+ -+anacron (1.0.4) unstable; urgency=low -+ -+ * Anacron is preconfigured to run the daily/weekly/monthly jobs now. -+ * Updated description to tell the user about this. -+ * Added "Suggests: cron". -+ * Changed behaviour of /etc/init.d/anacron script: Just run anacron if -+ it's later then 7:30am. -+ * Added scripts to /etc/cron.{daily,weekly,monthly} to update anacron's -+ time stamps (necessary if the scripts are run by cron). -+ * Added check and message to postinst script to tell the user about -+ adding a cron entry for anacron. -+ * Updated README file to describe new setup. -+ * Moved anacron script to /usr/sbin. -+ * Upgraded to Standards-Version 2.2.0.0. -+ -+ -- Christian Schwarz Sat, 2 Aug 1997 19:18:53 +0200 -+ -+anacron (1.0.3) unstable; urgency=low -+ -+ * Fixed date calculation (thanks to Itai Tzur for the patch!) -+ * Upgraded to Standards-Version 2.1.3.3. -+ -+ -- Christian Schwarz Wed, 2 Jul 1997 17:48:43 +0200 -+ -+anacron (1.0.2-1) unstable; urgency=low -+ -+ * New upstream source: improved README (fixes bug #5933). -+ * Changed console message in /etc/init.d to apply to new standard. -+ * Upgraded to Standards-Version 2.1.2.2. -+ * Removed buggy check for `pe' in postinst. -+ * Added `Replaces: pe' to control file. -+ -+ -- Christian Schwarz Thu, 9 Jan 1997 17:16:36 +0100 -+ -+anacron (1.0.1-3) unstable; urgency=low -+ -+ * Changed priority from standard to extra. -+ -+ -- Christian Schwarz Tue, 5 Nov 1996 22:30:37 +0100 -+ -+anacron (1.0.1-2) unstable; urgency=low -+ -+ * Upgraded to Standards-Version 2.1.1.0. -+ -+ -- Christian Schwarz Sat, 2 Nov 1996 20:31:12 +0100 -+ -+anacron (1.0.1-1) unstable; urgency=low -+ -+ * Upgraded to Standards-Version 2.1.0.0. -+ * Fixed problem when anacron was called multiple times. -+ * Changed distribution from experimental to unstable. -+ -+ -- Christian Schwarz Wed, 18 Sep 1996 20:00:40 +0200 -+ -+anacron (1.0-1) experimental; urgency=low -+ -+ * First Debian release. -+ * Changed program name from `pe' to `anacron'. -+ * Rewrote program and docs. -+ -+ -- Christian Schwarz Fri, 23 Aug 1996 22:32:33 +0200 -+ ---- anacron-2.3.orig/debian/anacron.postrm -+++ anacron-2.3/debian/anacron.postrm -@@ -0,0 +1,11 @@ -+#!/bin/sh -+ -+set -e -+ -+if [ "$1" = "purge" ]; then -+# here for historical reasons -+ rm -f /var/log/anacron /var/log/anacron.[0-9]* -+ rm -rf /var/spool/anacron -+fi -+ -+#DEBHELPER# ---- anacron-2.3.orig/debian/README.debian -+++ anacron-2.3/debian/README.debian -@@ -0,0 +1,13 @@ -+anacron for DEBIAN -+---------------------- -+ -+Anacron runs transparently to the system. In other words, you should never be -+aware that anacron and not cron is actually running cron.{daily,weekly,monthly}. -+ -+Anacron itself however is not a daemon, so it will either be called at startup, -+on APM power status change, or by cron. Disabling those will result in some -+jobs not being executed on time. -+ -+Anacron leaves messages in /var/log/syslog and /var/log/messages by default. -+ -+-- Pascal hakim , Tue, 02 Aug 2005 20:27:00 +1100 ---- anacron-2.3.orig/global.h -+++ anacron-2.3/global.h -@@ -2,6 +2,7 @@ - Anacron - run commands periodically - Copyright (C) 1998 Itai Tzur - Copyright (C) 1999 Sean 'Shaleh' Perry -+ Copyright (C) 2004 Pascal Hakim - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -@@ -53,9 +54,11 @@ - - struct job_rec1 { - int period; -+ int named_period; - int delay; - char *ident; - char *command; -+ char *mailto; - - int tab_line; - int arg_num; -@@ -75,9 +78,10 @@ - extern pid_t primary_pid; - extern char *program_name; - extern char *anacrontab; -+extern char *spooldir; - extern int old_umask; - extern sigset_t old_sigmask; --extern int serialize,force,update_only,now,no_daemon,quiet; -+extern int serialize,force,update_only,now,no_daemon,quiet,testing_only; - extern int day_now; - extern int year,month,day_of_month; - extern int in_background; -@@ -93,6 +97,7 @@ - - extern int running_jobs,running_mailers; - -+extern int complaints; - - /* Function prototypes */ - -@@ -121,7 +126,7 @@ - #endif /* not DEBUG */ - - /* readtab.c */ --void read_tab(); -+void read_tab(int cwd); - void arrange_jobs(); - - /* lock.c */ ---- anacron-2.3.orig/gregor.c -+++ anacron-2.3/gregor.c -@@ -2,6 +2,7 @@ - Anacron - run commands periodically - Copyright (C) 1998 Itai Tzur - Copyright (C) 1999 Sean 'Shaleh' Perry -+ Copyright (C) 2004 Pascal Hakim - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -@@ -23,6 +24,7 @@ - - - #include -+#include - #include "gregor.h" - - const static int -@@ -65,7 +67,7 @@ - { - int dn; - int i; -- const int isleap; /* save three calls to leap() */ -+ int isleap; /* save three calls to leap() */ - - /* Some validity checks */ - -@@ -114,3 +116,66 @@ - /* but not by 400 */ - return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); - } -+ -+int -+days_last_month (void) -+/* How many days did last month have? */ -+{ -+ struct tm time_record; -+ time_t current_time; -+ time (¤t_time); -+ localtime_r (¤t_time, &time_record); -+ -+ switch (time_record.tm_mon) { -+ case 0: return days_in_month[11]; -+ case 2: return days_in_month[1] + (leap (time_record.tm_year + 1900) ? 1 : 0); -+ default: return days_in_month[time_record.tm_mon - 1]; -+ } -+} -+ -+int -+days_this_month (void) -+/* How many days does this month have? */ -+{ -+ struct tm time_record; -+ time_t current_time; -+ time (¤t_time); -+ localtime_r (¤t_time, &time_record); -+ -+ switch (time_record.tm_mon) { -+ case 1: return days_in_month[1] + (leap (time_record.tm_year + 1900) ? 1 : 0); -+ default: return days_in_month[time_record.tm_mon]; -+ } -+} -+ -+int -+days_last_year (void) -+/* How many days this last year have? */ -+{ -+ struct tm time_record; -+ time_t current_time; -+ time (¤t_time); -+ localtime_r (¤t_time, &time_record); -+ -+ if (leap(time_record.tm_year - 1 + 1900)) { -+ return 366; -+ } -+ -+ return 365; -+} -+ -+int -+days_this_year (void) -+/* How many days does this year have */ -+{ -+ struct tm time_record; -+ time_t current_time; -+ time (¤t_time); -+ localtime_r (¤t_time, &time_record); -+ -+ if (leap(time_record.tm_year + 1900)) { -+ return 366; -+ } -+ -+ return 365; -+} ---- anacron-2.3.orig/gregor.h -+++ anacron-2.3/gregor.h -@@ -2,6 +2,7 @@ - Anacron - run commands periodically - Copyright (C) 1998 Itai Tzur - Copyright (C) 1999 Sean 'Shaleh' Perry -+ Copyright (C) 2004 Pascal Hakim - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -@@ -23,3 +24,7 @@ - - - int day_num(int year, int month, int day); -+int days_last_month (void); -+int days_this_month (void); -+int days_last_year (void); -+int days_this_year (void); ---- anacron-2.3.orig/lock.c -+++ anacron-2.3/lock.c -@@ -2,6 +2,7 @@ - Anacron - run commands periodically - Copyright (C) 1998 Itai Tzur - Copyright (C) 1999 Sean 'Shaleh' Perry -+ Copyirght (C) 2004 Pascal Hakim - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -@@ -111,6 +112,35 @@ - xclose(jr->timestamp_fd); - return 0; - } -+ -+ /* -+ * Check to see if it's a named period, in which case we need -+ * to figure it out. -+ */ -+ if (jr->named_period) -+ { -+ int period = 0, bypass = 0; -+ switch (jr->named_period) -+ { -+ case 1: -+ period = days_last_month (); -+ bypass = days_this_month (); -+ break; -+ case 2: -+ period = days_last_year (); -+ bypass = days_this_year (); -+ break; -+ default: -+ die ("Unknown named period for %s (%d)", jr->ident, jr->named_period); -+ } -+ printf ("Checking against %d with %d\n", day_delta, period); -+ if (day_delta < period && day_delta != bypass) -+ { -+ /* Job is still too young */ -+ xclose (jr->timestamp_fd); -+ return 0; -+ } -+ } - } - - /* no! try to grab the lock */ ---- anacron-2.3.orig/log.c -+++ anacron-2.3/log.c -@@ -2,6 +2,7 @@ - Anacron - run commands periodically - Copyright (C) 1998 Itai Tzur - Copyright (C) 1999 Sean 'Shaleh' Perry -+ Copyright (C) 2004 Pascal Hakim - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -@@ -48,6 +49,9 @@ - static char msg[MAX_MSG + 1]; - static int log_open = 0; - -+/* Number of complaints that we've seen */ -+int complaints = 0; -+ - static void - xopenlog() - { -@@ -147,6 +151,8 @@ - va_start(args, fmt); - log(COMPLAIN_LEVEL, fmt, args); - va_end(args); -+ -+ complaints += 1; - } - - void -@@ -158,6 +164,8 @@ - va_start(args, fmt); - log_e(COMPLAIN_LEVEL, fmt, args); - va_end(args); -+ -+ complaints += 1; - } - - void ---- anacron-2.3.orig/main.c -+++ anacron-2.3/main.c -@@ -2,6 +2,7 @@ - Anacron - run commands periodically - Copyright (C) 1998 Itai Tzur - Copyright (C) 1999 Sean 'Shaleh' Perry -+ Copyright (C) 2004 Pascal Hakim - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -@@ -39,8 +40,9 @@ - - char *program_name; - char *anacrontab; -+char *spooldir; - int serialize, force, update_only, now, -- no_daemon, quiet; /* command-line options */ -+ no_daemon, quiet, testing_only; /* command-line options */ - char **args; /* vector of "job" command-line arguments */ - int nargs; /* number of these */ - char *defarg = "*"; -@@ -61,17 +63,19 @@ - printf("Anacron " RELEASE "\n" - "Copyright (C) 1998 Itai Tzur \n" - "Copyright (C) 1999 Sean 'Shaleh' Perry \n" -+ "Copyright (C) 2004 Pascal Hakim \n" - "\n" -- "Mail comments, suggestions and bug reports to ." -+ "Mail comments, suggestions and bug reports to ." - "\n\n"); - } - - static void - print_usage() - { -- printf("Usage: anacron [-s] [-f] [-n] [-d] [-q] [-t anacrontab] [job] ...\n" -- " anacron -u [job] ...\n" -+ printf("Usage: anacron [-s] [-f] [-n] [-d] [-q] [-t anacrontab] [-S spooldir] [job] ...\n" -+ " anacron [-S spooldir] -u [job] ...\n" - " anacron [-V|-h]\n" -+ " anacron -T [-t anacrontab]\n" - "\n" - " -s Serialize execution of jobs\n" - " -f Force execution of jobs, even before their time\n" -@@ -82,6 +86,8 @@ - " -t Use this anacrontab\n" - " -V Print version information\n" - " -h Print this message\n" -+ " -T Test an anacrontab\n" -+ " -S Select a different spool directory\n" - "\n" - "See the manpage for more details.\n" - "\n"); -@@ -95,7 +101,7 @@ - - quiet = no_daemon = serialize = force = update_only = now = 0; - opterr = 0; -- while ((opt = getopt(argc, argv, "sfundqt:Vh")) != EOF) -+ while ((opt = getopt(argc, argv, "sfundqt:TS:Vh")) != EOF) - { - switch (opt) - { -@@ -120,6 +126,12 @@ - case 't': - anacrontab = strdup(optarg); - break; -+ case 'T': -+ testing_only = 1; -+ break; -+ case 'S': -+ spooldir = strdup(optarg); -+ break; - case 'V': - print_version(); - exit(0); -@@ -351,7 +363,7 @@ - day_of_month = tm_now->tm_mday; - day_now = day_num(year, month, day_of_month); - if (day_now == -1) die("Invalid date (this is really embarrassing)"); -- if (!update_only) -+ if (!update_only && !testing_only) - explain("Anacron " RELEASE " started on %04d-%02d-%02d", - year, month, day_of_month); - } -@@ -414,7 +426,10 @@ - { - int j; - -+ int cwd; -+ - anacrontab = NULL; -+ spooldir = NULL; - - if((program_name = strrchr(argv[0], '/')) == NULL) - program_name = argv[0]; -@@ -426,9 +441,16 @@ - if (anacrontab == NULL) - anacrontab = strdup(ANACRONTAB); - -+ if (spooldir == NULL) -+ spooldir = strdup(SPOOLDIR); -+ -+ if ((cwd = open ("./", O_RDONLY)) == -1) { -+ die_e ("Can't save current directory"); -+ } -+ - in_background = 0; - -- if (chdir(SPOOLDIR)) die_e("Can't chdir to " SPOOLDIR); -+ if (chdir(spooldir)) die_e("Can't chdir to %s", spooldir ); - - old_umask = umask(0); - -@@ -437,15 +459,22 @@ - if (fclose(stdin)) die_e("Can't close stdin"); - xopen(0, "/dev/null", O_RDONLY); - -- if (!no_daemon) -+ if (!no_daemon && !testing_only) - go_background(); - else - primary_pid = getpid(); - - record_start_time(); -- read_tab(); -+ read_tab(cwd); - arrange_jobs(); - -+ if (testing_only) -+ { -+ if (complaints) exit (1); -+ -+ exit (0); -+ } -+ - if (update_only) - { - fake_jobs(); -@@ -462,6 +491,6 @@ - launch_job(job_array[j]); - } - wait_children(); -- explain("Normal exit (%d jobs run)", njobs); -+ explain("Normal exit (%d job%s run)", njobs, (njobs == 1 ? "" : "s")); - exit(0); - } ---- anacron-2.3.orig/readtab.c -+++ anacron-2.3/readtab.c -@@ -2,6 +2,7 @@ - Anacron - run commands periodically - Copyright (C) 1998 Itai Tzur - Copyright (C) 1999 Sean 'Shaleh' Perry -+ Copyright (C) 2004 Pascal Hakim - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -@@ -83,11 +84,23 @@ - Return NULL if no more lines. - */ - { -- int c; -+ int c, prev=0; - - if (feof(tab)) return NULL; -- while ((c = getc(tab)) != EOF && c != '\n') -- obstack_1grow(&input_o, c); -+ while (1) -+ { -+ c = getc(tab); -+ if ((c == '\n' && prev != '\\') || c == EOF) -+ { -+ if (0 != prev) obstack_1grow(&input_o, prev); -+ break; -+ } -+ -+ if ('\\' != prev && 0 != prev && '\n' != prev) obstack_1grow(&input_o, prev); -+ else if ('\n' == prev) obstack_1grow(&input_o, ' '); -+ -+ prev = c; -+ } - if (ferror(tab)) die_e("Error reading %s", anacrontab); - obstack_1grow(&input_o, '\0'); - return obstack_finish(&input_o); -@@ -153,6 +166,7 @@ - } - jr = obstack_alloc(&tab_o, sizeof(job_rec)); - jr->period = period; -+ jr->named_period = 0; - jr->delay = delay; - jr->tab_line = line_num; - jr->ident = obstack_alloc(&tab_o, ident_len + 1); -@@ -171,6 +185,54 @@ - } - - static void -+register_period_job(const char *periods, const char *delays, -+ const char *ident, char *command) -+/* Store a job definition with a named period */ -+{ -+ int delay; -+ job_rec *jr; -+ int period_len, ident_len, command_len; -+ -+ period_len = strlen(periods); -+ ident_len = strlen(ident); -+ command_len = strlen(command); -+ jobs_read++; -+ delay = conv2int(delays); -+ if (delay < 0) -+ { -+ complain("%s: number out of range on line %d, skipping", -+ anacrontab, line_num); -+ return; -+ } -+ -+ 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; -+ } else { -+ complain("%s: Unknown named period on line %d, skipping", -+ anacrontab, line_num); -+ } -+ jr->period = 0; -+ jr->delay = delay; -+ jr->tab_line = line_num; -+ jr->ident = obstack_alloc(&tab_o, ident_len + 1); -+ strcpy(jr->ident, ident); -+ jr->arg_num = job_arg_num(ident); -+ jr->command = obstack_alloc(&tab_o, command_len + 1); -+ strcpy(jr->command, command); -+ jr->job_pid = jr->mailer_pid = 0; -+ if (last_job_rec != NULL) last_job_rec->next = jr; -+ else first_job_rec = jr; -+ last_job_rec = jr; -+ jr->prev_env_rec = last_env_rec; -+ jr->next = NULL; -+ Debug(("Read job - period %d, delay=%d, ident%s, command=%s", -+ jr->named_period, jr->delay, jr->ident, jr->command)); -+} -+ -+static void - parse_tab_line(char *line) - { - int r; -@@ -210,6 +272,18 @@ - register_job(periods, delays, ident, command); - return; - } -+ -+ /* A period job? */ -+ r = match_rx("^[ \t]*(@[^ \t]+)[ \t]+([[:digit:]]+)[ \t]+" -+ "([^ \t/]+)[ \t]+([^ \t].*)$", -+ line, 4, &periods, &delays, &ident, &command); -+ if (r == -1) goto reg_err; -+ if (r) -+ { -+ register_period_job(periods, delays, ident, command); -+ return; -+ } -+ - complain("Invalid syntax in %s on line %d - skipping this line", - anacrontab, line_num); - return; -@@ -219,7 +293,7 @@ - } - - void --read_tab() -+read_tab(int cwd) - /* Read the anacrontab file into memory */ - { - char *tab_line; -@@ -229,7 +303,10 @@ - jobs_read = 0; - line_num = 0; - /* Open the anacrontab file */ -+ fchdir (cwd); - tab = fopen(anacrontab, "r"); -+ if (chdir(spooldir)) die_e("Can't chdir to %s", SPOOLDIR); -+ - if (tab == NULL) die_e("Error opening %s", anacrontab); - /* Initialize the obstacks */ - obstack_init(&input_o); -@@ -271,7 +348,7 @@ - njobs = 0; - while (j != NULL) - { -- if (j->arg_num != -1 && (update_only || consider_job(j))) -+ if (j->arg_num != -1 && (update_only || testing_only || consider_job(j))) - { - njobs++; - obstack_grow(&tab_o, &j, sizeof(j)); ---- anacron-2.3.orig/runjob.c -+++ anacron-2.3/runjob.c -@@ -109,7 +109,6 @@ - run_job(const job_rec *jr) - /* This is called to start the job, after the fork */ - { -- setup_env(jr); - /* setup stdout and stderr */ - xclose(1); - xclose(2); -@@ -153,6 +152,15 @@ - launch_mailer(job_rec *jr) - { - pid_t pid; -+ struct stat buf; -+ int r; -+ -+ /* Check that we have a way of sending mail. */ -+ if(stat(SENDMAIL, &buf)) -+ { -+ complain("Can't find sendmail at %s, not mailing output", SENDMAIL); -+ return; -+ } - - pid = xfork(); - if (pid == 0) -@@ -173,7 +181,7 @@ - * options, which don't seem to be appropriate here. - * Hopefully, this will keep all the MTAs happy. */ - execl(SENDMAIL, SENDMAIL, "-FAnacron", "-odi", -- username(), (char *)NULL); -+ jr->mailto, (char *)NULL); - die_e("Can't exec " SENDMAIL); - } - /* parent */ -@@ -207,19 +215,44 @@ - { - pid_t pid; - int fd; -+ char hostname[512]; -+ char *mailto; -+ -+ /* get hostname */ -+ if (gethostname(hostname, 512)) { -+ strcpy (hostname,"unknown machine"); -+ } -+ -+ setup_env(jr); -+ -+ /* Get the destination email address if set, or current user otherwise */ -+ mailto = getenv("MAILTO"); -+ -+ if (mailto) -+ jr->mailto = mailto; -+ else -+ jr->mailto = username (); - - /* create temporary file for stdout and stderr of the job */ - fd = jr->output_fd = temp_file(); - /* write mail header */ - xwrite(fd, "From: "); -+ xwrite(fd, "Anacron <"); - xwrite(fd, username()); -- xwrite(fd, " (Anacron)\n"); -+ xwrite(fd, ">\n"); - xwrite(fd, "To: "); -- xwrite(fd, username()); -+ if (mailto) { -+ xwrite(fd, mailto); -+ } else { -+ xwrite(fd, username()); -+ } - xwrite(fd, "\n"); - xwrite(fd, "Subject: Anacron job '"); - xwrite(fd, jr->ident); -- xwrite(fd, "'\n\n"); -+ xwrite(fd, "' on "); -+ xwrite(fd, hostname); -+ xwrite(fd, "\n\n"); -+ - jr->mail_header_size = file_size(fd); - - pid = xfork(); diff --git a/anacrontab b/anacrontab deleted file mode 100644 index 78c6f8c..0000000 --- a/anacrontab +++ /dev/null @@ -1,16 +0,0 @@ -# /etc/anacrontab: configuration file for anacron - -# See anacron(8) and anacrontab(5) for details. - -SHELL=/bin/sh -PATH=/sbin:/bin:/usr/sbin:/usr/bin -MAILTO=root -# the maximal random delay added to the base delay of the jobs -RANDOM_DELAY=45 -# 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 diff --git a/manAUX_Limit.patch b/manAUX_Limit.patch deleted file mode 100644 index 87e6d09..0000000 --- a/manAUX_Limit.patch +++ /dev/null @@ -1,96 +0,0 @@ -diff -up anacron-2.3/anacron.8.aux anacron-2.3/anacron.8 ---- anacron-2.3/anacron.8.aux 2009-03-24 14:16:39.000000000 +0100 -+++ anacron-2.3/anacron.8 2009-03-24 14:22:41.000000000 +0100 -@@ -1,4 +1,4 @@ --.TH ANACRON 8 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" -+.TH ANACRON 8 2009-03-24 "Marcela Mašláňová" "Anacron Users' Manual" - .SH NAME - anacron \- runs commands periodically - .SH SYNOPSIS -@@ -66,8 +66,8 @@ exists. If the LOGNAME environment varia - field. - .PP - Informative messages about what Anacron is doing are sent to \fBsyslogd(8)\fR --under facility \fBcron\fR, priority \fBnotice\fR. Error messages are sent at --priority \fBerror\fR. -+or \fBrsyslogd(8)\fR under facility \fBcron\fR, priority \fBnotice\fR. Error -+messages are sent at priority \fBerror\fR. - .PP - "Active" jobs (i.e. jobs that Anacron already decided - to run and now wait for their delay to pass, and jobs that are currently -@@ -163,4 +163,5 @@ The current implementation is a complete - The code base was maintained by Sean 'Shaleh' Perry . - .PP - Since 2004, it is maintained by Pascal Hakim . -- -+.PP -+For Fedora is anacron maintained by Marcela Mašláňová . -diff -up anacron-2.3/anacrontab.5.aux anacron-2.3/anacrontab.5 ---- anacron-2.3/anacrontab.5.aux 2009-03-24 14:16:39.000000000 +0100 -+++ anacron-2.3/anacrontab.5 2009-03-24 14:23:39.000000000 +0100 -@@ -1,4 +1,4 @@ --.TH ANACRONTAB 5 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" -+.TH ANACRONTAB 5 2009-03-24 "Marcela Mašláňová" "Anacron Users' Manual" - .SH NAME - /etc/anacrontab \- configuration file for anacron - .SH DESCRIPTION -@@ -15,11 +15,20 @@ Job-description lines are of one of thes - .PP - @period_name delay job-identify command - .PP --The -+The - .I period --is specified in days, the -+is specified in days, the - .I delay --in minutes. The -+in minutes. In addition, if the -+.I RANDOM_DELAY -+environment variable is set, then the value of -+.I RANDOM_DELAY -+is added to the delay. The value in -+.I RANDOM_DELAY -+denotes a maximal additional delay in minutes, where the minimum delay value is set, to user delay from anacrontab. A -+.I RANDOM_DELAY -+set to 12 would therefore add, randomly, between 0 and 12 minutes to the user defined delay. -+The - .I job-identifier - can contain any non-blank character, except slashes. It is used to identify - the job in Anacron messages, -@@ -42,12 +51,28 @@ are removed. No spaces around - .I VALUE - are allowed (unless you want them to be part of the value). The assignment - takes effect from the next line to the end of the file, or to the next --assignment of the same variable. -+assignment of the same variable. The enviroment variable -+.I START_HOURS_RANGE -+sets the time frame, when the job could started. - .PP - Empty lines are either blank lines, line containing white-space only, or - lines with white-space followed by a '#' followed by an arbitrary comment. - .PP - You can continue a line onto the next line by ending it with a '\'. -+.SH EXAMPLE -+.nf -+# environment variables -+SHELL=/bin/sh -+PATH=/sbin:/bin:/usr/sbin:/usr/bin -+MAILTO=root -+RANDOM_DELAY=60 -+# Anacron jobs will start between 6 and 8 o'clock. -+START_HOURS_RANGE=6-8 -+# delay will be 5 minutes + RANDOM_DELAY for cron.daily -+1 5 cron.daily nice run-parts /etc/cron.daily -+7 8 cron.weekly nice run-parts /etc/cron.weekly -+@monthly 35 cron.monthly nice run-parts /etc/cron.monthly -+.fi - .SH "SEE ALSO" - .B anacron(8) - .PP -@@ -58,3 +83,5 @@ file. - Itai Tzur - .PP - Currently maintained by Pascal Hakim . -+.PP -+For Fedora maintained by Marcela Mašláňová . From 89cb7c17c9a064b70a2c0515a8239bec804827a7 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 25 Nov 2009 22:39:43 +0000 Subject: [PATCH 28/31] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9fd3e6e..9770649 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # Makefile for source rpm: anacron -# $Id: Makefile,v 1.1 2004/09/09 02:58:39 cvsdist Exp $ +# $Id: Makefile,v 1.2 2007/10/15 18:35:42 notting Exp $ NAME := anacron SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From 061e3ca86a4adabecfbf94a8fea52cdfae1bfa60 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 26 Nov 2009 01:27:37 +0000 Subject: [PATCH 29/31] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9fd3e6e..9770649 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # Makefile for source rpm: anacron -# $Id: Makefile,v 1.1 2004/09/09 02:58:39 cvsdist Exp $ +# $Id: Makefile,v 1.2 2007/10/15 18:35:42 notting Exp $ NAME := anacron SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From bc1ce995623a913ab5c54893ec096e1278eb166c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 29 Dec 2009 19:36:48 +0000 Subject: [PATCH 30/31] Obsoleted by cronie-anacron as of F-12. --- .cvsignore | 3 --- Makefile | 21 --------------------- dead.package | 1 + sources | 3 --- 4 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 .cvsignore delete mode 100644 Makefile create mode 100644 dead.package delete mode 100644 sources diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 5ffb207..0000000 --- a/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -anacron_2.3.orig.tar.gz -anacron.init -0hourly diff --git a/Makefile b/Makefile deleted file mode 100644 index 9770649..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: anacron -# $Id: Makefile,v 1.2 2007/10/15 18:35:42 notting Exp $ -NAME := anacron -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attempt a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/dead.package b/dead.package new file mode 100644 index 0000000..983275a --- /dev/null +++ b/dead.package @@ -0,0 +1 @@ +Obsoleted by cronie-anacron as of F-12. diff --git a/sources b/sources deleted file mode 100644 index 648d5cf..0000000 --- a/sources +++ /dev/null @@ -1,3 +0,0 @@ -9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz -4b98b6b029e76aa6e0fa3fde2ec5572a 0hourly -e2d8c06a7b5c46b30317456ffd9d312d anacron From 20e57b473323528594b581548cb39e0ff8f3974c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 29 Jul 2010 17:06:37 +0000 Subject: [PATCH 31/31] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- branch | 1 - 3 files changed, 22 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 9770649..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: anacron -# $Id: Makefile,v 1.2 2007/10/15 18:35:42 notting Exp $ -NAME := anacron -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attempt a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index 1c26f78..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -F-9