Compare commits

...
This repository has been archived on 2026-01-16. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.

6 commits

Author SHA1 Message Date
Fedora Release Engineering
20e57b4733 dist-git conversion 2010-07-29 17:06:37 +00:00
Bill Nottingham
061e3ca86a Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:27:37 +00:00
Marcela Mašláňová
04db00a4ce - 477709 hack aroung problems with running jobs twice
- remove patches 6 a 7, they were obsoleted by this hack
2009-02-02 06:40:47 +00:00
Marcela Mašláňová
08a5d1b934 - rewrite init script - using fedora guidelines SysVInitScript 2008-10-23 13:47:16 +00:00
Marcela Mašláňová
c9e1ba6ac9 - correct init script - really kill anacron 2008-09-22 16:08:47 +00:00
Jesse Keating
065159fa73 Initialize branch F-9 for anacron 2008-04-20 12:15:16 +00:00
7 changed files with 127 additions and 108 deletions

View file

@ -1,2 +1,5 @@
anacron_2.3.orig.tar.gz anacron_2.3.orig.tar.gz
anacron.init anacron.init
runanacron
anacrontab
anacron.cron

View file

@ -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)

View file

@ -1,7 +1,7 @@
diff -uNr anacron-2.3-orig/global.h anacron-2.3/global.h diff -up anacron-2.3/global.h.fdclose anacron-2.3/global.h
--- anacron-2.3-orig/global.h 2000-06-23 01:00:14.000000000 +0100 --- anacron-2.3/global.h.fdclose 2008-09-23 10:06:04.000000000 +0200
+++ anacron-2.3/global.h 2006-03-20 15:31:28.000000000 +0000 +++ anacron-2.3/global.h 2008-09-23 10:06:04.000000000 +0200
@@ -60,6 +60,7 @@ @@ -63,6 +63,7 @@ struct job_rec1 {
int tab_line; int tab_line;
int arg_num; int arg_num;
int timestamp_fd; int timestamp_fd;
@ -9,9 +9,9 @@ diff -uNr anacron-2.3-orig/global.h anacron-2.3/global.h
int output_fd; int output_fd;
int mail_header_size; int mail_header_size;
pid_t job_pid; pid_t job_pid;
diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c diff -up anacron-2.3/runjob.c.fdclose anacron-2.3/runjob.c
--- anacron-2.3-orig/runjob.c 2006-02-21 14:05:08.000000000 +0000 --- anacron-2.3/runjob.c.fdclose 2008-09-23 10:06:04.000000000 +0200
+++ anacron-2.3/runjob.c 2006-03-20 15:32:32.000000000 +0000 +++ anacron-2.3/runjob.c 2008-09-23 10:06:04.000000000 +0200
@@ -38,12 +38,12 @@ @@ -38,12 +38,12 @@
#include <langinfo.h> #include <langinfo.h>
@ -27,7 +27,7 @@ diff -uNr anacron-2.3-orig/runjob.c anacron-2.3/runjob.c
i = 0; i = 0;
name = NULL; name = NULL;
@@ -53,16 +53,24 @@ @@ -53,16 +53,24 @@ temp_file()
free(name); free(name);
name = tempnam(NULL, NULL); name = tempnam(NULL, NULL);
if (name == NULL) die("Can't find a unique temporary filename"); 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 static off_t
@@ -170,17 +178,28 @@ @@ -167,17 +175,28 @@ launch_mailer(job_rec *jr)
pid = xfork(); pid = xfork();
if (pid == 0) 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 /* Here, I basically mirrored the way /usr/sbin/sendmail is called
* by cron on a Debian system, except for the "-oem" and "-or0s" * by cron on a Debian system, except for the "-oem" and "-or0s"
* options, which don't seem to be appropriate here. * options, which don't seem to be appropriate here.
@@ -225,7 +244,7 @@ @@ -236,7 +255,7 @@ launch_job(job_rec *jr)
setup_env(jr); jr->mailto = username ();
/* create temporary file for stdout and stderr of the job */ /* create temporary file for stdout and stderr of the job */
- fd = jr->output_fd = temp_file(); - fd = jr->output_fd = temp_file();
+ temp_file(jr); fd = jr->output_fd; + temp_file(jr); fd = jr->output_fd;
/* write mail header */ /* write mail header */
xwrite(fd, "From: "); xwrite(fd, "From: ");
xwrite(fd, username()); xwrite(fd, "Anacron <");
@@ -283,6 +302,7 @@ @@ -302,6 +321,7 @@ tend_job(job_rec *jr, int status)
running_jobs--; running_jobs--;
if (mail_output) launch_mailer(jr); if (mail_output) launch_mailer(jr);
xclose(jr->output_fd); xclose(jr->output_fd);

View file

@ -1,6 +1,6 @@
diff -u anacron-2.3/runjob.c~ anacron-2.3/runjob.c diff -up anacron-2.3/runjob.c.charset anacron-2.3/runjob.c
--- anacron-2.3/runjob.c~ 2003-07-10 15:25:44.000000000 +0900 --- anacron-2.3/runjob.c.charset 2008-09-23 09:42:49.000000000 +0200
+++ anacron-2.3/runjob.c 2003-07-10 15:25:44.000000000 +0900 +++ anacron-2.3/runjob.c 2008-09-23 09:42:49.000000000 +0200
@@ -35,6 +35,8 @@ @@ -35,6 +35,8 @@
#include <string.h> #include <string.h>
#include "global.h" #include "global.h"
@ -10,13 +10,13 @@ diff -u anacron-2.3/runjob.c~ anacron-2.3/runjob.c
static int static int
temp_file() temp_file()
/* Open a temporary file and return its file descriptor */ /* Open a temporary file and return its file descriptor */
@@ -217,6 +219,9 @@ @@ -247,6 +249,9 @@ launch_job(job_rec *jr)
xwrite(fd, "To: "); xwrite(fd, username());
xwrite(fd, username()); }
xwrite(fd, "\n"); xwrite(fd, "\n");
+ xwrite(fd, "Content-Type: text/plain; charset=\""); + xwrite(fd, "Content-Type: text/plain; charset=\"");
+ xwrite(fd, nl_langinfo(CODESET)); + xwrite(fd, nl_langinfo(CODESET));
+ xwrite(fd, "\"\n"); + xwrite(fd, "\"\n");
xwrite(fd, "Subject: Anacron job '"); xwrite(fd, "Subject: Anacron job '");
xwrite(fd, jr->ident); xwrite(fd, jr->ident);
xwrite(fd, "'\n\n"); xwrite(fd, "' on ");

View file

@ -1,82 +1,99 @@
#!/bin/sh #!/bin/sh
# Startup script for anacron
# #
# chkconfig: 2345 99 05 # anacron Run cron jobs that were left out due to downtime.
# 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. # Source function library.
. /etc/rc.d/init.d/functions . /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" lockfile=/var/lock/subsys/$prog
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.
#
start() { start() {
echo -n $"Starting $prog: " [ -x $exec ] || exit 5
echo -n $"Starting $prog: "
daemon +19 anacron -s daemon +19 anacron -s
RETVAL=$? retval=$?
if [ $RETVAL -ne 0 ]; then
failure;
fi;
echo echo
[ $retval -eq 0 ]
## && touch $lockfile it creates lock in code
return $retval
} }
stop() { stop() {
echo -n $"Stopping $prog: " echo -n $"Stopping $prog: "
if [ -f $PIDFILE ]; then killproc $prog
killproc anacron retval=$?
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
failure;
fi;
else
failure;
fi
echo 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 case "$1" in
start) start)
start rh_status_q && exit 0
;; $1
;;
stop) stop)
stop rh_status_q || exit 0
;; $1
;;
status) restart)
## hard to say - anacron is up only when cron wake him $1
status $prog ;;
RETVAL=$? status)
;; rh_status
;;
restart) condrestart)
stop rh_status_q || exit 0
start restart
;; ;;
*)
condrestart) echo $"Usage: $0 {start|stop|status|restart|condrestart}"
if [ -f /var/lock/subsys/anacron ]; then exit 2
stop
sleep 2
start
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=3
esac esac
exit $?
exit $RETVAL

View file

@ -1,20 +1,22 @@
Summary: A cron-like program that can run jobs lost during downtime Summary: A cron-like program that can run jobs lost during downtime
Name: anacron Name: anacron
Version: 2.3 Version: 2.3
Release: 60%{?dist} Release: 63%{?dist}
License: GPLv2+ License: GPLv2+
Group: System Environment/Base Group: System Environment/Base
URL: http://packages.debian.org/stable/source/anacron URL: http://packages.debian.org/stable/source/anacron
Source: http://ftp.debian.org/debian/pool/main/a/anacron/%{name}_%{version}.orig.tar.gz Source: http://ftp.debian.org/debian/pool/main/a/anacron/%{name}_%{version}.orig.tar.gz
Source1: anacrontab Source1: anacrontab
Source2: anacron.init Source2: anacron.init
Source3: runanacron
Source4: anacron.cron
Patch0: anacron_2.3-13.patch Patch0: anacron_2.3-13.patch
Patch1: anacron-2.3-mail-content-type-77108.patch Patch1: anacron-2.3-mail-content-type-77108.patch
Patch2: anacron-2.3-fdclose.patch Patch2: anacron-2.3-fdclose.patch
Patch3: anacron-2.3-pic.patch Patch3: anacron-2.3-pic.patch
Patch4: anacron-2.3-memleaking.patch Patch4: anacron-2.3-memleaking.patch
Patch5: anacron-2.3-onbattery.patch #Patch5: anacron-2.3-onbattery.patch
Patch6: anacron-2.3-sterr_null.patch #Patch6: anacron-2.3-sterr_null.patch
Patch7: anacron-2.3-spooldir.patch Patch7: anacron-2.3-spooldir.patch
Requires: crontabs Requires: crontabs
@ -47,8 +49,8 @@ jobs of other Red Hat Linux (or Fedora) packages are executed each day.
%patch2 -p1 -b .fdclose %patch2 -p1 -b .fdclose
%patch3 -p1 -b .pic %patch3 -p1 -b .pic
%patch4 -p1 -b .memleaking %patch4 -p1 -b .memleaking
%patch5 -p1 -b .onbattery #%patch5 -p1 -b .onbattery
%patch6 -p1 -b .sterr #%patch6 -p1 -b .sterr
%patch7 -p1 -b .spool %patch7 -p1 -b .spool
%build %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/ 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 %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 %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
@ -104,17 +109,29 @@ fi
/%{_mandir}/man5/* /%{_mandir}/man5/*
/%{_mandir}/man8/* /%{_mandir}/man8/*
/usr/sbin/anacron /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.daily/0anacron
%attr(755,root,root) %dir /etc/cron.monthly/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.weekly/0anacron
%changelog %changelog
* Mon Feb 2 2009 Marcela Mašláňová <mmaslano@redhat.com> 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á <mmaslano@redhat.com> 2.3-62
- rewrite init script - using fedora guidelines SysVInitScript
* Mon Sep 22 2008 Marcela Maslanova <mmaslano@redhat.com> 2.3-61
- correct init script - really kill anacron
* Wed Apr 9 2008 Marcela Maslanova <mmaslano@redhat.com> 2.3-60 * Wed Apr 9 2008 Marcela Maslanova <mmaslano@redhat.com> 2.3-60
- correct spooldir logged - correct spooldir logged
* Thu Feb 28 2008 Marcela Maslanova <mmaslano@redhat.com> 2.3-59 * Thu Feb 28 2008 Marcela Maslanova <mmaslano@redhat.com> 2.3-59
- 0anacron.{daily,weekly,monthly} sterror's output also goes to - 0anacron.{daily,weekly,monthly} sterror's output also goes to
dev/null dev/null
- rhbz#435255 - rhbz#435255
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.3-58 * Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.3-58

View file

@ -1,2 +1,5 @@
9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz 9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz
094af5e05723d2c4924d60f73d738509 anacron.init 094af5e05723d2c4924d60f73d738509 anacron.init
1e65b1fcb49c7929645a1bd0baffd7ef runanacron
e4368e8f686c710f63027af0f213cfe5 anacrontab
312b5eed93765e26e9d21f23bccc72c9 anacron.cron