rpms/anacron/devel anacron-2.3-hourly.patch, NONE, 1.1 anacron-2.3-log.patch, NONE, 1.1 anacron.init, 1.14, 1.15 anacron.spec, 1.47, 1.48 anacron-script.patch, 1.2, NONE

Marcela Mašláňová (mmaslano) fedora-extras-commits at redhat.com
Wed May 28 14:07:27 UTC 2008


Author: mmaslano

Update of /cvs/pkgs/rpms/anacron/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30175

Modified Files:
	anacron.init anacron.spec 
Added Files:
	anacron-2.3-hourly.patch anacron-2.3-log.patch 
Removed Files:
	anacron-script.patch 
Log Message:
- 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:

--- NEW FILE anacron-2.3-hourly.patch ---
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
+

anacron-2.3-log.patch:

--- NEW FILE anacron-2.3-log.patch ---
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);
 }


Index: anacron.init
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacron.init,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- anacron.init	11 Dec 2007 08:09:04 -0000	1.14
+++ anacron.init	28 May 2008 14:06:40 -0000	1.15
@@ -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 @@
 #
 
 start() {
+    [ -x /usr/sbin/anacron ] || exit 5
     echo -n $"Starting $prog: " 
     daemon +19 anacron -s
     RETVAL=$?
@@ -55,7 +54,8 @@
 	    ;;
 	
 	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 @@
 esac
 
 exit $RETVAL
+


Index: anacron.spec
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacron.spec,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- anacron.spec	9 Apr 2008 10:53:21 -0000	1.47
+++ anacron.spec	28 May 2008 14:06:40 -0000	1.48
@@ -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 @@
 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 @@
 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 @@
 %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 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 @@
 /%{_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 <mmaslano at redhat.com> 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 <mmaslano at redhat.com> 2.3-60
 - correct spooldir logged
 


--- anacron-script.patch DELETED ---




More information about the scm-commits mailing list