From 065159fa73b4e38c1d1856edae92f053abe74199 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Sun, 20 Apr 2008 12:15:16 +0000 Subject: [PATCH 1/6] 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 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 2/6] - 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 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 3/6] - 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 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 4/6] - 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 061e3ca86a4adabecfbf94a8fea52cdfae1bfa60 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 26 Nov 2009 01:27:37 +0000 Subject: [PATCH 5/6] 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 20e57b473323528594b581548cb39e0ff8f3974c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 29 Jul 2010 17:06:37 +0000 Subject: [PATCH 6/6] 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