Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20e57b4733 | ||
|
|
061e3ca86a | ||
|
|
04db00a4ce | ||
|
|
08a5d1b934 | ||
|
|
c9e1ba6ac9 | ||
|
|
065159fa73 |
7 changed files with 127 additions and 108 deletions
3
.cvsignore → .gitignore
vendored
3
.cvsignore → .gitignore
vendored
|
|
@ -1,2 +1,5 @@
|
|||
anacron_2.3.orig.tar.gz
|
||||
anacron.init
|
||||
runanacron
|
||||
anacrontab
|
||||
anacron.cron
|
||||
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)
|
||||
|
|
@ -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 <langinfo.h>
|
||||
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 <string.h>
|
||||
#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 ");
|
||||
|
|
|
|||
139
anacron.init
139
anacron.init
|
|
@ -1,82 +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=$?
|
||||
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
|
||||
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
|
||||
|
|
|
|||
29
anacron.spec
29
anacron.spec
|
|
@ -1,20 +1,22 @@
|
|||
Summary: A cron-like program that can run jobs lost during downtime
|
||||
Name: anacron
|
||||
Version: 2.3
|
||||
Release: 60%{?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,17 +109,29 @@ 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á <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
|
||||
- correct spooldir logged
|
||||
|
||||
* Thu Feb 28 2008 Marcela Maslanova <mmaslano@redhat.com> 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 <rel-eng@fedoraproject.org> - 2.3-58
|
||||
|
|
|
|||
3
sources
3
sources
|
|
@ -1,2 +1,5 @@
|
|||
9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz
|
||||
094af5e05723d2c4924d60f73d738509 anacron.init
|
||||
1e65b1fcb49c7929645a1bd0baffd7ef runanacron
|
||||
e4368e8f686c710f63027af0f213cfe5 anacrontab
|
||||
312b5eed93765e26e9d21f23bccc72c9 anacron.cron
|
||||
|
|
|
|||
Reference in a new issue