Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8262820f3b | ||
|
|
0729f4d694 | ||
|
|
d1ce6a95ec | ||
|
|
dcb91f461c | ||
|
|
5311bac45e | ||
|
|
c0d4051464 | ||
|
|
2a30a23470 |
7 changed files with 96 additions and 23 deletions
2
.cvsignore → .gitignore
vendored
2
.cvsignore → .gitignore
vendored
|
|
@ -1,2 +1,4 @@
|
|||
anacron_2.3.orig.tar.gz
|
||||
anacron.init
|
||||
anacron.cron
|
||||
runanacron
|
||||
21
Makefile
21
Makefile
|
|
@ -1,21 +0,0 @@
|
|||
# Makefile for source rpm: anacron
|
||||
# $Id: Makefile,v 1.1 2004/09/09 02:58:39 cvsdist 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
|
||||
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)
|
||||
42
anacron-2.3-hourly.patch
Normal file
42
anacron-2.3-hourly.patch
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
diff -urN anacron-2.3/fedora.mm/anacron.daily anacron-2.3/fedora/anacron.daily
|
||||
--- anacron-2.3/fedora.mm/anacron.daily 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ anacron-2.3/fedora/anacron.daily 2008-10-30 12:44:27.000000000 +0100
|
||||
@@ -0,0 +1,38 @@
|
||||
+#!/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
|
||||
+
|
||||
+#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
|
||||
12
anacron-2.3-spooldir.patch
Normal file
12
anacron-2.3-spooldir.patch
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
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 */
|
||||
11
anacron.init
11
anacron.init
|
|
@ -34,6 +34,17 @@ start() {
|
|||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# If starting within 15 minutes of midnight or before 5 am, defer until
|
||||
# the scheduled 5am anacron run -- this allows the regular cron jobs to
|
||||
# run first, so that anacron doesn't repeat jobs that the regular cron
|
||||
# job will pick up as well.
|
||||
|
||||
if [ `date +%H -d "15 minutes"` -le 4 ] ; then
|
||||
echo "deferred until after the regular morning cron job run"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
daemon +19 anacron -s
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
|
|
|
|||
29
anacron.spec
29
anacron.spec
|
|
@ -1,18 +1,22 @@
|
|||
%define _default_patch_fuzz 2
|
||||
Summary: A cron-like program that can run jobs lost during downtime
|
||||
Name: anacron
|
||||
Version: 2.3
|
||||
Release: 56%{?dist}
|
||||
Release: 59%{?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-spooldir.patch
|
||||
|
||||
Requires: crontabs
|
||||
Requires: initscripts
|
||||
|
|
@ -44,6 +48,7 @@ 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 .spool
|
||||
|
||||
%build
|
||||
make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
|
||||
|
|
@ -53,7 +58,6 @@ 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/
|
||||
|
|
@ -66,10 +70,17 @@ 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
|
||||
#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
|
||||
|
||||
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
|
||||
|
||||
|
|
@ -99,11 +110,25 @@ 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 Jan 5 2009 Marcela Mašláňová <mmaslano@redhat.com> 2.3-59
|
||||
- 472275 apply changes from pspencer, which should fix most of
|
||||
problems like running some jobs twice.
|
||||
|
||||
* Thu Oct 30 2008 Marcela Mašláňová <mmaslano@redhat.com> 2.3-58
|
||||
- same script for all cron.something should prevent double jobs
|
||||
- correct spooldir is logged
|
||||
|
||||
* Tue Dec 11 2007 Marcela Maslanova <mmaslano@redhat.com> 2.3-57
|
||||
- 0anacron.{daily,weekly,monthly} check whether they are on battery
|
||||
- rhbz#387301
|
||||
|
||||
* Tue Sep 25 2007 Marcela Maslanova <mmaslano@redhat.com> 2.3-56
|
||||
- cron.{hourly,daily} work correct -> remove checking whether
|
||||
cron.daily has been run
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1,2 +1,4 @@
|
|||
9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz
|
||||
094af5e05723d2c4924d60f73d738509 anacron.init
|
||||
312b5eed93765e26e9d21f23bccc72c9 anacron.cron
|
||||
1e65b1fcb49c7929645a1bd0baffd7ef runanacron
|
||||
|
|
|
|||
Reference in a new issue