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.

43 commits

Author SHA1 Message Date
Ville Skyttä
bc1ce99562 Obsoleted by cronie-anacron as of F-12. 2009-12-29 19:36:48 +00:00
Bill Nottingham
89cb7c17c9 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-25 22:39:43 +00:00
Marcela Mašláňová
c684c1163e This package has been obsoleted by cronie. 2009-07-20 18:22:12 +00:00
Marcela Mašláňová
8a3fc308bb #507598 in case lock doesn't exist then the script spam user about non
existent file.
2009-06-30 13:14:34 +00:00
Marcela Mašláňová
8a736b2eb1 - and now upload new source 2009-05-15 12:24:10 +00:00
Marcela Mašláňová
483a8bad02 Enviroment values must be set for cronjob. 2009-05-15 11:58:51 +00:00
Marcela Mašláňová
b633ca9231 - 495333 fix ungrammatical job(s) in log 2009-04-14 14:16:40 +00:00
Marcela Mašláňová
9871122470 - rewrite the range and random patches with checking log to one more lucid
with help of tmraz.
2009-03-27 09:43:13 +00:00
Marcela Mašláňová
1e6c8f2359 Fix typo in anacron again. 2009-03-06 08:14:58 +00:00
Jesse Keating
17ed917047 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild 2009-02-24 01:04:09 +00:00
Marcela Mašláňová
e76c227507 - incorrect logging of jobs - fixed number of executed jobs
- really planed jobs are mentioned
- 252254 fix typo in bash script 0anacron
2009-02-19 14:06:19 +00:00
Marcela Mašláňová
967a35b81e - apply fix of my previous range patch from tmraz
- fix man page
2009-02-10 09:58:12 +00:00
Marcela Mašláňová
3c1b0922d9 - add two new options:
- 481775 some people don't want to run daily jobs at all, if they didn't
    run in specific time f.e. 4-7 hours.
- 470168 random delay was removed from crontabs and added into anacron,
    where could be better set.
- cron.d/0hourly will every hour run cron.hourly/0anacron which check
    whether the jobs should be running or not
2009-02-06 14:08:07 +00:00
Marcela Mašláňová
0a0d307a39 - 482782 output in init script redirected 2009-01-28 12:34:43 +00:00
Marcela Mašláňová
2fbe527339 Thr Jan 28 2009 Marcela Mašláňová <mmaslano@redhat.com> 2.3-67
- 482782 output in init script redirected
2009-01-28 09:46:38 +00:00
Marcela Mašláňová
026329cd1f - cron.{daily,weekly,hourly,monthly} should be owned by crontabs, because
some don't have installed anacron and other cron like programmes could
    be dependent
- 0anacron is now trying run all cron.{daily,weekly,...} every hour. This
    should fix problem with jobs running twice, with not running jobs after
    hibernation and so on.
- the random delay is in default switch off
2009-01-26 09:25:53 +00:00
Marcela Mašláňová
4e2effc666 - rewrite init script - using fedora guidelines SysVInitScript 2008-10-24 13:02:50 +00:00
Marcela Mašláňová
776f818eb0 - fix fuzz
- fix previous patch, thanks to mbroz
2008-09-23 08:27:10 +00:00
Marcela Mašláňová
cee41ed7e1 Fix fuzz problem, remove unused patches. 2008-09-23 08:23:14 +00:00
Marcela Mašláňová
5c8d131bb7 Fix fuzz. 2008-09-23 06:47:39 +00:00
Marcela Mašláňová
f18e3e8e83 - fix previous patch, thanks to mbroz 2008-09-22 16:12:15 +00:00
Marcela Mašláňová
e7fd054254 - 441576 really stop anacron daemon 2008-09-22 16:07:05 +00:00
Marcela Mašláňová
7d3cf7fb69 - 441576 really stop anacron daemon 2008-07-30 14:09:55 +00:00
Marcela Mašláňová
f770fe7452 - cleaning lots of scripts in anacron & crontabs 2008-05-30 12:45:31 +00:00
Marcela Mašláňová
7156cbaee2 - 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)
2008-05-28 14:06:40 +00:00
Marcela Mašláňová
af83b5e4cf Correct spooldir in log file. 2008-04-09 10:53:21 +00:00
Marcela Mašláňová
62e44a61d2 Fix time in changelog. 2008-02-28 13:19:02 +00:00
Marcela Mašláňová
2efbfa90e3 - 0anacron.{daily,weekly,monthly} sterror's output also goes to dev/null 2008-02-28 13:17:33 +00:00
Jesse Keating
021b66a3d8 - Autorebuild for GCC 4.3 2008-02-19 14:25:02 +00:00
Marcela Mašláňová
f939ee9475 0anacron.{daily,weekly,monthly} check whether they are on battery 2007-12-11 08:09:04 +00:00
Bill Nottingham
74abd403b8 makefile update to properly grab makefile.common 2007-10-15 18:35:42 +00:00
Marcela Mašláňová
f199bf0da9 - cron.{hourly,daily} work correct -> remove checking whether cron.daily
has been run
- persist: run pc between midnight and 4:02 -> cron.daily run twice.
- rhbz#296741
2007-09-25 08:54:37 +00:00
Marcela Mašláňová
db5a92d659 Add anacron in post to chkconfig 2007-08-31 07:27:32 +00:00
Marcela Mašláňová
4b75a47989 Change setting up chkconfig in spec. 2007-08-30 13:06:21 +00:00
Marcela Mašláňová
01cc213167 Fix starting of anacron with post macro. 2007-08-17 10:38:46 +00:00
Marcela Mašláňová
a950359d71 Change scripts and spec for better functionality. 2007-08-15 11:27:28 +00:00
Marcela Mašláňová
a9fa487483 Rebuil 2007-08-14 10:34:55 +00:00
Marcela Mašláňová
eb13ba20f7 Change in init script. 2007-08-14 10:31:16 +00:00
Marcela Mašláňová
e35aaa24e4 Change init script. 2007-08-13 08:43:48 +00:00
Marcela Mašláňová
e8923e2673 Add patch 2007-08-09 13:27:22 +00:00
Marcela Mašláňová
bdb5ac3085 Add patches. 2007-08-09 13:25:22 +00:00
Marcela Mašláňová
3af20f7a4a Change init script. 2007-07-12 11:30:22 +00:00
Marcela Mašláňová
b052d01a75 Change in init script 2007-07-11 15:12:06 +00:00
17 changed files with 1 additions and 1185 deletions

View file

@ -1,2 +0,0 @@
anacron_2.3.orig.tar.gz
anacron.init

View file

@ -1,6 +0,0 @@
# Makefile for source rpm: anacron
# $Id$
NAME := anacron
SPECFILE = $(firstword $(wildcard *.spec))
include ../common/Makefile.common

View file

@ -1,107 +0,0 @@
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 @@
int tab_line;
int arg_num;
int timestamp_fd;
+ int input_fd;
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
@@ -38,12 +38,12 @@
#include <langinfo.h>
static int
-temp_file()
+temp_file(job_rec *jr)
/* Open a temporary file and return its file descriptor */
{
const int max_retries = 50;
char *name;
- int fd, i;
+ int fdin, fdout, i;
i = 0;
name = NULL;
@@ -53,16 +53,24 @@
free(name);
name = tempnam(NULL, NULL);
if (name == NULL) die("Can't find a unique temporary filename");
- fd = open(name, O_RDWR | O_CREAT | O_EXCL | O_APPEND,
- S_IRUSR | S_IWUSR);
+ fdout = open(name, O_WRONLY | O_CREAT | O_EXCL | O_APPEND,
+ S_IRUSR | S_IWUSR);
+ if ( fdout != -1 )
+ fdin = open(name, O_RDONLY, S_IRUSR | S_IWUSR);
/* I'm not sure we actually need to be so persistent here */
- } while (fd == -1 && errno == EEXIST && i < max_retries);
+ } while (fdout == -1 && errno == EEXIST && i < max_retries);
- if (fd == -1) die_e("Can't open temporary file");
+ if (fdout == -1) die_e("Can't open temporary file for writing");
+ if (fdin == -1) die_e("Can't open temporary file for reading");
if (unlink(name)) die_e("Can't unlink temporary file");
free(name);
- fcntl(fd, F_SETFD, 1); /* set close-on-exec flag */
- return fd;
+ fcntl(fdout, F_SETFD, 1); /* set close-on-exec flag */
+ fcntl(fdin, F_SETFD, 1); /* set close-on-exec flag */
+
+ jr->input_fd = fdin;
+ jr->output_fd = fdout;
+
+ return fdout;
}
static off_t
@@ -170,17 +178,28 @@
pid = xfork();
if (pid == 0)
{
+ long fdflags;
+
/* child */
in_background = 1;
/* set stdin to the job's output */
xclose(0);
- if (dup2(jr->output_fd, 0) != 0) die_e("Can't dup2()");
+ if (dup2(jr->input_fd, 0) != 0) die_e("Can't dup2()");
if (lseek(0, 0, SEEK_SET) != 0) die_e("Can't lseek()");
umask(old_umask);
if (sigprocmask(SIG_SETMASK, &old_sigmask, NULL))
die_e("sigprocmask error");
xcloselog();
+ /* Ensure stdout/stderr are sane before exec-ing sendmail */
+ xclose(1); xopen(1, "/dev/null", O_WRONLY);
+ xclose(2); xopen(2, "/dev/null", O_WRONLY);
+ xclose(jr->output_fd);
+
+ /* Ensure stdin is not appendable ... ? */
+ /* fdflags = fcntl(0, F_GETFL); fdflags &= ~O_APPEND; */
+ /* fcntl(0, F_SETFL, fdflags ); */
+
/* 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);
/* 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 @@
running_jobs--;
if (mail_output) launch_mailer(jr);
xclose(jr->output_fd);
+ xclose(jr->input_fd);
}
void

View file

@ -1,44 +0,0 @@
--- anacron-2.3/runjob.c.hostname 2006-10-04 11:58:55.000000000 +0200
+++ anacron-2.3/runjob.c 2006-10-09 09:43:23.000000000 +0200
@@ -94,6 +94,17 @@
}
static char *
+hostname()
+{
+ char hostname[MAXHOSTNAME];
+
+ if (gethostname(hostname, MAXHOSTNAME) == 0)
+ return hostname;
+ else
+ die_e("Can't resolve hostname");
+}
+
+static char *
mailto()
{
char *alias;
@@ -255,9 +266,11 @@
xwrite(fd, "Content-Type: text/plain; charset=\"");
xwrite(fd, nl_langinfo(CODESET));
xwrite(fd, "\"\n");
- xwrite(fd, "Subject: Anacron job '");
+ xwrite(fd, "Subject: Anacron job for '");
+ xwrite(fd, hostname());
+ xwrite(fd, "' ");
xwrite(fd, jr->ident);
- xwrite(fd, "'\n\n");
+ xwrite(fd, "\n");
jr->mail_header_size = file_size(fd);
pid = xfork();
--- anacron-2.3/global.h.hostname 2006-10-04 11:58:55.000000000 +0200
+++ anacron-2.3/global.h 2006-10-04 11:58:55.000000000 +0200
@@ -33,6 +33,7 @@
/* Mail interface. (All MTAs should supply this command) */
#define SENDMAIL "/usr/sbin/sendmail"
+#define MAXHOSTNAME 64
#ifndef PID_FILE
#define PID_FILE "/var/run/anacron.pid"

View file

@ -1,248 +0,0 @@
--- anacron-2.3/main.c.lock-files 2000-06-22 20:00:14.000000000 -0400
+++ anacron-2.3/main.c 2006-04-13 20:38:13.000000000 -0400
@@ -21,39 +21,42 @@
`COPYING' that comes with the Anacron source distribution.
*/
-
-#include <time.h>
-#include <stdio.h>
+#include <sys/types.h>
#include <unistd.h>
+#include <time.h>
#include <signal.h>
#include <fcntl.h>
-#include <sys/types.h>
+#include <sys/ioctl.h>
#include <sys/stat.h>
#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <errno.h>
#include "global.h"
#include "gregor.h"
-pid_t primary_pid;
-int day_now;
-int year, month, day_of_month; /* date anacron started */
-
-char *program_name;
-char *anacrontab;
-int serialize, force, update_only, now,
- no_daemon, quiet; /* command-line options */
-char **args; /* vector of "job" command-line arguments */
-int nargs; /* number of these */
+pid_t primary_pid=-1;
+int day_now=0;
+int year=0, month=0, day_of_month=0; /* date anacron started */
+
+char *program_name=0;
+char *anacrontab=0;
+int serialize=0, force=0, update_only=0, now=0,
+ no_daemon=0, quiet=0; /* command-line options */
+char **args=0; /* vector of "job" command-line arguments */
+int nargs=0; /* number of these */
char *defarg = "*";
-int in_background; /* are we in the background? */
-int old_umask; /* umask when started */
-sigset_t old_sigmask; /* signal mask when started */
-
-job_rec *first_job_rec;
-env_rec *first_env_rec;
-
-static time_t start_sec; /* time anacron started */
-static volatile int got_sigalrm, got_sigchld, got_sigusr1;
-int running_jobs, running_mailers; /* , number of */
+int in_background=0; /* are we in the background? */
+int old_umask=0; /* umask when started */
+sigset_t old_sigmask={0}; /* signal mask when started */
+
+job_rec *first_job_rec=0;
+env_rec *first_env_rec=0;
+
+static time_t start_sec=0; /* time anacron started */
+static volatile int got_sigalrm=0, got_sigchld=0, got_sigusr1=0;
+int running_jobs=0, running_mailers=0; /* , number of */
static void
print_version()
@@ -183,6 +186,8 @@
if (close(fd)) die_e("Can't close file descriptor %d", fd);
}
+static int anacron_already_running();
+
static void
go_background()
/* Become a daemon. The foreground process exits successfully. */
@@ -206,9 +211,16 @@
else
{
/* child */
+ xcloselog();
primary_pid = getpid();
if (setsid() == -1) die_e("setsid() error");
in_background = 1;
+ chdir(SPOOLDIR);
+ if( anacron_already_running() )
+ {
+ errno=EDEADLK;
+ die_e("Cannot run in daemon mode - anacron already running.");
+ }
}
}
@@ -265,6 +277,16 @@
sa.sa_mask = ss;
sa.sa_flags = 0;
if (sigaction(SIGUSR1, &sa, NULL)) die_e("sigaction error");
+ /* setup SIGQUIT handler */
+ sa.sa_handler = handle_sigusr1;
+ sa.sa_mask = ss;
+ sa.sa_flags = 0;
+ if (sigaction(SIGQUIT, &sa, NULL)) die_e("sigaction error");
+ /* setup SIGTERM handler */
+ sa.sa_handler = handle_sigusr1;
+ sa.sa_mask = ss;
+ sa.sa_flags = 0;
+ if (sigaction(SIGTERM, &sa, NULL)) die_e("sigaction error");
}
static void
@@ -409,6 +431,94 @@
explain("Jobs will be executed sequentially");
}
+static void remove_lock_and_pid_files(void)
+{
+ unlink(PID_FILE);
+ unlink(LOCK_FILE);
+}
+
+static int anacron_already_running()
+{
+ char buf[PATH_MAX], buf2[PATH_MAX], buf3[32];
+ FILE *fp=0;
+ pid_t pid=-1;
+ mode_t mode;
+ int len, fd;
+
+ if ( access( PID_FILE, F_OK ) == 0 )
+ {
+ if ( ( fp = fopen( PID_FILE, "r" ) ) == 0L )
+ {
+ complain("%s exists but is not readable",PID_FILE);
+ return 1;
+ }
+
+ if ( fscanf(fp,"%u",&pid) != 1 )
+ {
+ explain("%s does not contain a valid pid",PID_FILE);
+ return 1;
+ }
+
+ fclose(fp);
+
+ snprintf(buf, PATH_MAX, "/proc/%u", pid);
+
+ if( access(buf, F_OK) == 0 )
+ {
+
+ snprintf(buf3, 32, "/proc/%u/exe", pid);
+ if( (len = readlink(buf3, buf2, PATH_MAX)) <= 0 )
+ len = 0;
+
+ buf2[len] = '\0';
+
+ snprintf(buf3, 32, "/proc/%u/exe", getpid());
+ if( (len = readlink(buf3, buf, PATH_MAX)) <= 0 )
+ len = 0;
+ buf[len] = '\0';
+
+ if( strcmp( buf, buf2 ) == 0 )
+ return 1;
+ }
+ }
+ /* main process removes lock files once it
+ * has determined no other anacron is running:
+ */
+ remove_lock_and_pid_files();
+
+ if( no_daemon || in_background )
+ {
+ /* daemon process, or main process in no_daemon mode,
+ * creates the lock and pid files:
+ */
+ if( ( fd = open(LOCK_FILE, O_CREAT | O_WRONLY | O_EXCL, 0600) ) == -1 )
+ {
+ complain("Cannot exclusively create %s: %s",PID_FILE,strerror(errno));
+ return 1;
+ }
+ close(fd);
+
+ mode = umask(0077);
+ if( ( fp = fopen(PID_FILE, "w") ) == 0L )
+ {
+ complain("Cannot create %s",PID_FILE);
+ umask(mode);
+ return 1;
+ }
+ umask(mode);
+
+ /* lock and pid files removed automatically at normal exit
+ * by creator process:
+ */
+ atexit( remove_lock_and_pid_files );
+
+ fprintf(fp,"%u",getpid());
+ fflush(fp);
+ fclose(fp);
+ }
+ return 0;
+}
+
int
main(int argc, char *argv[])
{
@@ -423,6 +533,12 @@
parse_opts(argc, argv);
+ if ( anacron_already_running() )
+ {
+ errno=EDEADLK;
+ die_e("Cannot run - another anacron process is already running.");
+ }
+
if (anacrontab == NULL)
anacrontab = strdup(ANACRONTAB);
@@ -433,7 +549,9 @@
old_umask = umask(0);
if (sigprocmask(0, NULL, &old_sigmask)) die_e("sigset error");
-
+
+ if( !no_daemon )
+ ioctl(0,TIOCNOTTY,0);
if (fclose(stdin)) die_e("Can't close stdin");
xopen(0, "/dev/null", O_RDONLY);
--- anacron-2.3/global.h.lock-files 2000-06-22 20:00:14.000000000 -0400
+++ anacron-2.3/global.h 2006-04-13 20:25:42.000000000 -0400
@@ -34,6 +34,14 @@
/* Mail interface. (All MTAs should supply this command) */
#define SENDMAIL "/usr/sbin/sendmail"
+#ifndef PID_FILE
+#define PID_FILE "/var/run/anacron.pid"
+#endif
+
+#ifndef LOCK_FILE
+#define LOCK_FILE "/var/lock/subsys/anacron"
+#endif
+
/* End of user-configurable section */

View file

@ -1,22 +0,0 @@
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
@@ -35,6 +35,8 @@
#include <string.h>
#include "global.h"
+#include <langinfo.h>
+
static int
temp_file()
/* Open a temporary file and return its file descriptor */
@@ -217,6 +219,9 @@
xwrite(fd, "To: ");
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");

View file

@ -1,58 +0,0 @@
diff -U 3 anacron-2.3.oud/runjob.c anacron-2.3/runjob.c
--- anacron-2.3.oud/runjob.c 2000-06-21 01:12:18.000000000 +0200
+++ anacron-2.3/runjob.c 2004-07-09 19:05:22.314056376 +0200
@@ -83,6 +83,18 @@
return ps->pw_name;
}
+static char *
+mailto()
+{
+ char *alias;
+
+ alias = getenv("MAILTO");
+ if (alias == NULL || strlen(alias) == 0)
+ return username();
+ else
+ return alias;
+}
+
static void
xputenv(const char *s)
{
@@ -109,7 +121,6 @@
run_job(const job_rec *jr)
/* This is called to start the job, after the fork */
{
- setup_env(jr);
/* setup stdout and stderr */
xclose(1);
xclose(2);
@@ -173,7 +184,7 @@
* options, which don't seem to be appropriate here.
* Hopefully, this will keep all the MTAs happy. */
execl(SENDMAIL, SENDMAIL, "-FAnacron", "-odi",
- username(), (char *)NULL);
+ mailto(), (char *)NULL);
die_e("Can't exec " SENDMAIL);
}
/* parent */
@@ -208,6 +219,9 @@
pid_t pid;
int fd;
+ /* import environment for mailto() to work properly */
+ setup_env(jr);
+
/* create temporary file for stdout and stderr of the job */
fd = jr->output_fd = temp_file();
/* write mail header */
@@ -215,7 +229,7 @@
xwrite(fd, username());
xwrite(fd, " (Anacron)\n");
xwrite(fd, "To: ");
- xwrite(fd, username());
+ xwrite(fd, mailto());
xwrite(fd, "\n");
xwrite(fd, "Subject: Anacron job '");
xwrite(fd, jr->ident);

View file

@ -1,213 +0,0 @@
diff -ur anacron-2.3.orig/global.h anacron-2.3/global.h
--- anacron-2.3.orig/global.h 2006-10-08 09:58:47.000000000 -0400
+++ anacron-2.3/global.h 2006-10-08 10:08:18.000000000 -0400
@@ -108,18 +108,25 @@
/* main.c */
int xopen(int fd, const char *file_name, int flags);
void xclose(int fd);
-pid_t xfork();
+pid_t xfork(void);
+
+#ifdef __GNUC__
+#define PRINTF_FORMAT(n, m) \
+ __attribute__ ((format (printf, n, m)))
+#else
+#define PRINTF_FORMAT(n, m)
+#endif
/* log.c */
-void explain(const char *fmt, ...);
-void explain_e(const char *fmt, ...);
-void complain(const char *fmt, ...);
-void complain_e(const char *fmt, ...);
-void die(const char *fmt, ...);
-void die_e(const char *fmt, ...);
-void xdebug(const char *fmt, ...);
-void xdebug_e(const char *fmt, ...);
-void xcloselog();
+void explain(const char *fmt, ...)PRINTF_FORMAT(1,2);
+void explain_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
+void complain(const char *fmt, ...)PRINTF_FORMAT(1,2);
+void complain_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
+void die(const char *fmt, ...)PRINTF_FORMAT(1,2);
+void die_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
+void xdebug(const char *fmt, ...)PRINTF_FORMAT(1,2);
+void xdebug_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
+void xcloselog(void);
#ifdef DEBUG
#define Debug(args) xdebug args
@@ -130,8 +137,8 @@
#endif /* not DEBUG */
/* readtab.c */
-void read_tab();
-void arrange_jobs();
+void read_tab(void);
+void arrange_jobs(void);
/* lock.c */
int consider_job(job_rec *jr);
diff -ur anacron-2.3.orig/gregor.c anacron-2.3/gregor.c
--- anacron-2.3.orig/gregor.c 2006-10-08 09:58:47.000000000 -0400
+++ anacron-2.3/gregor.c 2006-10-08 10:24:05.000000000 -0400
@@ -25,7 +25,7 @@
#include <limits.h>
#include "gregor.h"
-const static int
+static const int
days_in_month[] = {
31, /* Jan */
28, /* Feb (non-leap) */
diff -ur anacron-2.3.orig/lock.c anacron-2.3/lock.c
--- anacron-2.3.orig/lock.c 2006-10-08 09:58:47.000000000 -0400
+++ anacron-2.3/lock.c 2006-10-08 16:14:14.000000000 -0400
@@ -42,7 +42,7 @@
jr->timestamp_fd = open(jr->ident, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (jr->timestamp_fd == -1)
die_e("Can't open timestamp file for job %s", jr->ident);
- fcntl(jr->timestamp_fd, F_SETFD, 1); /* set close-on-exec flag */
+ fcntl(jr->timestamp_fd, F_SETFD, FD_CLOEXEC); /* set close-on-exec flag */
/* We want to own this file, and set its mode to 0600. This is necessary
* in order to prevent other users from putting locks on it. */
if (fchown(jr->timestamp_fd, getuid(), getgid()))
diff -ur anacron-2.3.orig/log.c anacron-2.3/log.c
--- anacron-2.3.orig/log.c 2006-10-08 09:58:47.000000000 -0400
+++ anacron-2.3/log.c 2006-10-08 10:27:29.000000000 -0400
@@ -35,6 +35,7 @@
*/
#include <unistd.h>
+#include <stdlib.h>
#include <syslog.h>
#include <stdio.h>
#include <stdarg.h>
@@ -79,7 +80,7 @@
}
static void
-log(int priority, const char *fmt, va_list args)
+slog(int priority, const char *fmt, va_list args)
/* Log a message, described by "fmt" and "args", with the specified
* "priority". */
{
@@ -97,7 +98,7 @@
static void
log_e(int priority, const char *fmt, va_list args)
-/* Same as log(), but also appends an error description corresponding
+/* Same as slog(), but also appends an error description corresponding
* to "errno". */
{
int saved_errno;
@@ -123,7 +124,7 @@
va_list args;
va_start(args, fmt);
- log(EXPLAIN_LEVEL, fmt, args);
+ slog(EXPLAIN_LEVEL, fmt, args);
va_end(args);
}
@@ -145,7 +146,7 @@
va_list args;
va_start(args, fmt);
- log(COMPLAIN_LEVEL, fmt, args);
+ slog(COMPLAIN_LEVEL, fmt, args);
va_end(args);
}
@@ -167,7 +168,7 @@
va_list args;
va_start(args, fmt);
- log(COMPLAIN_LEVEL, fmt, args);
+ slog(COMPLAIN_LEVEL, fmt, args);
va_end(args);
if (getpid() == primary_pid) complain("Aborted");
@@ -199,7 +200,7 @@
va_list args;
va_start(args, fmt);
- log(DEBUG_LEVEL, fmt, args);
+ slog(DEBUG_LEVEL, fmt, args);
va_end(args);
}
diff -ur anacron-2.3.orig/matchrx.c anacron-2.3/matchrx.c
--- anacron-2.3.orig/matchrx.c 2006-10-08 09:58:47.000000000 -0400
+++ anacron-2.3/matchrx.c 2006-10-08 10:29:24.000000000 -0400
@@ -26,6 +26,7 @@
#include <regex.h>
#include <stdarg.h>
#include <stdlib.h>
+#include <string.h>
#include "matchrx.h"
int
@@ -49,11 +50,23 @@
sub_offsets = malloc(sizeof(regmatch_t) * (n_sub + 1));
memset(sub_offsets, 0, sizeof(regmatch_t) * (n_sub + 1));
- if (regcomp(&crx, rx, REG_EXTENDED)) return - 1;
+ if (regcomp(&crx, rx, REG_EXTENDED))
+ {
+ free(sub_offsets);
+ return - 1;
+ }
r = regexec(&crx, string, n_sub + 1, sub_offsets, 0);
- if (r != 0 && r != REG_NOMATCH) return - 1;
+ if (r != 0 && r != REG_NOMATCH)
+ {
+ free(sub_offsets);
+ return - 1;
+ }
regfree(&crx);
- if (r == REG_NOMATCH) return 0;
+ if (r == REG_NOMATCH)
+ {
+ free(sub_offsets);
+ return 0;
+ }
va_start(va, n_sub);
n = 1;
@@ -62,7 +75,11 @@
substring = va_arg(va, char**);
if (substring != NULL)
{
- if (sub_offsets[n].rm_so == -1) return - 1;
+ if (sub_offsets[n].rm_so == -1)
+ {
+ free(sub_offsets);
+ return - 1;
+ }
*substring = string + sub_offsets[n].rm_so;
*(string + sub_offsets[n].rm_eo) = 0;
}
diff -ur anacron-2.3.orig/runjob.c anacron-2.3/runjob.c
--- anacron-2.3.orig/runjob.c 2006-10-08 09:58:47.000000000 -0400
+++ anacron-2.3/runjob.c 2006-10-08 16:09:37.000000000 -0400
@@ -64,8 +64,8 @@
if (fdin == -1) die_e("Can't open temporary file for reading");
if (unlink(name)) die_e("Can't unlink temporary file");
free(name);
- fcntl(fdout, F_SETFD, 1); /* set close-on-exec flag */
- fcntl(fdin, F_SETFD, 1); /* set close-on-exec flag */
+ fcntl(fdout, F_SETFD, FD_CLOEXEC); /* set close-on-exec flag */
+ fcntl(fdin, F_SETFD, FD_CLOEXEC); /* set close-on-exec flag */
jr->input_fd = fdin;
jr->output_fd = fdout;
@@ -178,7 +178,7 @@
pid = xfork();
if (pid == 0)
{
- long fdflags;
+ /* long fdflags; */
/* child */
in_background = 1;

View file

@ -1,12 +0,0 @@
diff -u anacron-2.3/Makefile~ anacron-2.3/Makefile
--- anacron-2.3/Makefile~ 2002-08-28 19:18:49.000000000 +0900
+++ anacron-2.3/Makefile 2002-08-28 19:18:49.000000000 +0900
@@ -54,7 +54,7 @@
$(SHELL) -ec "$(CC) -MM $(ALL_CPPFLAGS) $< \
| sed '1s/^\(.*\)\.o[ :]*/\1.d &/1' > $@"
-include $(csources:.c=.d)
+-include $(csources:.c=.d)
anacron: $(objects)
$(CC) $(LDFLAGS) $^ $(LOADLIBES) -o $@

View file

@ -1,11 +0,0 @@
--- anacron-2.3/gregor.c.sopwith 2004-07-02 10:51:24.000000000 -0400
+++ anacron-2.3/gregor.c 2004-07-02 10:51:33.000000000 -0400
@@ -65,7 +65,7 @@
{
int dn;
int i;
- const int isleap; /* save three calls to leap() */
+ int isleap; /* save three calls to leap() */
/* Some validity checks */

View file

@ -1,11 +0,0 @@
--- ./anacrontab.path 2006-08-30 14:57:23.000000000 +0200
+++ ./anacrontab 2006-08-30 14:58:09.000000000 +0200
@@ -3,7 +3,7 @@
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
1 65 cron.daily run-parts /etc/cron.daily

View file

@ -1,12 +0,0 @@
--- anacron-2.3/Makefile.piee 2006-10-17 12:39:39.000000000 +0200
+++ anacron-2.3/Makefile 2006-10-17 12:39:39.000000000 +0200
@@ -22,7 +22,8 @@
PREFIX =
BINDIR = $(PREFIX)/usr/sbin
MANDIR = $(PREFIX)/usr/man
-CFLAGS = -Wall -pedantic -O2
+LDFLAGS = -fpie -Wl,-z,relro
+CFLAGS = -Wall -pedantic -W -Wundef -fpie
#CFLAGS = -Wall -O2 -g -DDEBUG
# If you change these, please update the man-pages too

View file

@ -1,83 +0,0 @@
#!/bin/sh
# Startup script for anacron
#
# chkconfig: 2345 95 05
# description: Run cron jobs that were left out due to downtime
# pidfile: /var/run/anacron.pid
#
# Source function library.
. /etc/rc.d/init.d/functions
[ -f /usr/sbin/anacron ] || exit 0
prog="anacron"
PIDFILE=/var/run/${prog}.pid
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 /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.
#
start() {
echo -n $"Starting $prog: "
daemon +19 anacron -s
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
failure;
fi;
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
if [ -f $PIDFILE ]; then
killproc anacron
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
failure;
fi;
else
RETVAL=1
failure;
fi
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status anacron
;;
restart)
stop
start
;;
condrestart)
if [ -f $LOCKFILE ]; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL

View file

@ -1,343 +0,0 @@
Summary: A cron-like program that can run jobs lost during downtime
Name: anacron
Version: 2.3
Release: 47%{?dist}
License: GPL
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
Patch0: anacron-2.3-mk-incl.patch
Patch1: anacron-2.3-mail-content-type-77108.patch
Patch2: anacron-2.3-noconst.patch
Patch3: anacron-2.3-mailto.patch
Patch4: anacron-2.3-lock-files.patch
Patch5: anacron-2.3-fdclose.patch
Patch6: anacron-2.3-hostname.patch
#Patch7: anacron-2.3-pie.patch
#Patch8: anacron-2.3-memoryleak.patch
Patch9: anacron-2.3-pic.patch
Patch10: anacron-2.3-memleaking.patch
Requires: /bin/sh
Requires: crontabs
Requires: initscripts
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(postun): /sbin/service
Requires(preun): /sbin/service
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
%description
Anacron (like `anac(h)ronistic') is a periodic command scheduler.
It executes commands at intervals specified in days. Unlike cron, it
does not assume that the system is running continuously. It can
therefore be used to control the execution of daily, weekly and
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.
This package is pre-configured to execute the daily jobs of the Red
Hat Linux (Fedora Core) 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 (Fedora Core) packages are executed each day.
%prep
%setup -q
%patch0 -p1 -b .incl
%patch1 -p1 -b .charset
%patch2 -p1 -b .noconst
%patch3 -p1 -b .mailto
%patch4 -p1 -b .lock-files
%patch5 -p1 -b .fdclose
%patch6 -p1 -b .hostname
#%patch7 -p1 -b .pie
#%patch8 -p1 -b .memoryleak
%patch9 -p1 -b .pic
%patch10 -p1 -b .memleaking
%build
make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
%install
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/
cp %SOURCE1 $RPM_BUILD_ROOT/etc
for i in cron.daily cron.weekly cron.monthly;do
mkdir -p $RPM_BUILD_ROOT/etc/$i/
cat << EOF > $RPM_BUILD_ROOT/etc/$i/0anacron
#!/bin/sh
#
# anacron's cron script
#
# This script updates anacron time stamps. It is called through run-parts
# either by anacron itself or by cron.
#
# The script is called "0anacron" to assure that it will be executed
# _before_ all other scripts.
# Don't run anacron if this script is called by anacron.
if [ ! -e /var/run/anacron.pid ]; then
anacron -u $i
fi
EOF
chmod +x $RPM_BUILD_ROOT/etc/$i/0anacron
done
#
#for i in `find $RPM_BUILD_ROOT/ -type 'f' -perm '+a=x'`;do
# file $i|grep -q "not stripped" && strip $i
#done
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
install -c -m755 %SOURCE2 $RPM_BUILD_ROOT/etc/rc.d/init.d/anacron
%clean
rm -rf $RPM_BUILD_ROOT
%post
/sbin/chkconfig --add anacron
%preun
if [ "$1" = "0" ]; then
service anacron stop >/dev/null 2>&1
/sbin/chkconfig --del anacron
fi
%postun
if [ "$1" -ge "1" ]; then
service anacron condrestart >/dev/null 2>&1
fi
%files
%defattr(-,root,root,0755)
%doc COPYING README
%config(noreplace) /etc/anacrontab
%dir /var/spool/anacron/
%config(noreplace) /etc/rc.d/init.d/*
/%{_mandir}/man5/*
/%{_mandir}/man8/*
/usr/sbin/anacron
##%config(noreplace) /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.weekly/0anacron
%changelog
* Tue Feb 6 2007 Marcela Maslanova <mmaslano@redhat.com> 2.3-47
- thanks for review from Jef Spaleta
- rhbz#225247, rhbz#211309
* Mon Dec 04 2006 Marcela Maslanova <mmaslano@redhat.com> 2.3-45
- rebuilt with pie insted pic
* Tue Oct 10 2006 Marcela Maslanova <mmaslano@redhat.com> 2.3-44
- fix memory leaking (both #210020)
- PIE(PIC) executable
* Tue Oct 2 2006 Marcela Maslanova <mmaslano@redhat.com> 2.3-42
- hostname added to mail (#208914)
* Fri Sep 29 2006 Marcela Maslanova <mmaslano@redhat.com> 2.3-41
- change spec file - patch from Orion Poplawski (#191410)
* Mon Sep 11 2006 Dan Walsh <dwalsh@redhat.com> 2.3-40
- Grab the fdclose patch from FC4
- fix bug 185973: allow use of sendmail under selinux-policy-strict:
apply patch contributed by Ted Rule<ejtr@layer3.co.uk>
* Wed Aug 30 2006 Jitka Kudrnacova <jkudrnac@redhat.com> - 2.3-39
- modified PATH in /etc/anacrontab file to make the same as in /etc/crontab (#61891)
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 2.3-38.FC6.1
- rebuild
* Thu Apr 13 2006 Jason Vas Dias <jvdias@redhat.com> - 2.3-38.1
- fix bug 188403: anacron SysVinit locking:
Since anacron just exits when it has no more work to do, the
initscript cannot do normal /var/lock/subsys/anacron lock file
creation, else messages such as 'anacron dead but subsys locked'
will appear when changing init levels.
Now, the anacron process itself creates its own
/var/lock/subsys/anacron SysVinit lock file and
/var/run/anacron.pid pid file to co-operate more
gracefully with the initscript system.
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 2.3-36.1
- bump again for double-long bug on ppc(64)
* Tue Feb 07 2006 Jason Vas Dias <jvdias@redhat.com> - 2.3-36
- rebuild for new gcc, glibc, glibc-kernheaders
* Wed Jan 11 2006 Peter Jones <pjones@redhat.com> 2.3-35
- Fix initscript so changing runlevel shuts it down correctly
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Wed Mar 16 2005 Jason Vas Dias <jvdias@redhat.com> 2.3-34
- Rebuild with gcc4 in FC4.
* Mon Feb 21 2005 Jason Vas Dias <jvdias@redhat.com> 2.3-33
- Rebuild for FC4 .
* Tue Sep 28 2004 Rik van Riel <riel@redhat.com> 2.3-32
- add MAILTO option, like vixie cron has (bz#127924)
* Fri Jul 2 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
- Add noconst patch to fix invalid C
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Thu Jul 10 2003 Jens Petersen <petersen@redhat.com> - 2.3-29
- don't require vixie-cron (#21176) [reported by Gerald Teschl]
- in init script don't remove /var/lock/subsys/anacron when stopping (#58462)
- exit init script with actual exit status (#44600) [reported by Enrico Scholz]
* Thu Jul 10 2003 Jens Petersen <petersen@redhat.com> - 2.3-28
- add a Content-Type header to mails giving the charset encoding (#77108)
* Thu Jul 10 2003 Jens Petersen <petersen@redhat.com> - 2.3-27
- in init script do not touch /var/lock/subsys/anacron when starting (#58462)
- require crontabs (#21176)
- update source url
* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt
* Wed Dec 11 2002 Tim Powers <timp@redhat.com> 2.3-24
- rebuild on all arches
* Fri Aug 23 2002 Jens Petersen <petersen@redhat.com> 2.3-23
- delay the start of anacron by 60min to make startup more pleasant (#68304)
- at startup run jobs serially and nice 19 to reduce load (#65870, #68304)
- spec file now in utf-8
- dont install non-existant NEWS file
- silence make include warnings
* Fri Jul 19 2002 Akira TAGOH <tagoh@redhat.com> 2.3-22
- fix the stripped binary issue.
* Mon Jul 08 2002 Bill Huang <bhuang@redhat.com>
- Update "Copyright" to "License" in spec file
* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Wed Jan 09 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Sun Jun 24 2001 Elliot Lee <sopwith@redhat.com>
- Bump release + rebuild.
* Tue Apr 3 2001 Crutcher Dunnavant <crutcher@redhat.com>
- add dependancy to vixie-cron (for /usr/bin/run-parts)
* Tue Feb 13 2001 Tim Waugh <twaugh@redhat.com>
- killproc is a shell function and can't be passed as a parameter
(bug #27150).
* Mon Feb 5 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- Fix i18n in initscript ("Stopping anacron" wasn't translated)
(#26076)
* Fri Feb 2 2001 Trond Eivind Glomsrød <teg@redhat.com>
- i18nize initscript
* Thu Dec 7 2000 Crutcher Dunnavant <crutcher@redhat.com>
- rebuild in rebuild cycle.
* Mon Oct 30 2000 Matt Wilson <msw@redhat.com>
- touch /var/lock/subsys/anacron to prevent excess startage during
init level change
* Wed Aug 30 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Shut down earlier to prevent NFS mounted /usr filesystems from causing
problems (Bug #16257)
* Fri Aug 4 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Start it later so services some cron scripts may depend on are running
(Bug #15335)
* Thu Aug 3 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Fix up initscript (Bug #15123 and an unreported bug)
* Sat Jul 15 2000 Bill Nottingham <notting@redhat.com>
- move initscript back
* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild
* Mon Jul 10 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Fix up initscripts (Bug #13625)
* Tue Jul 4 2000 Matt Wilson <msw@redhat.com>
- Prereq: /sbin/chkconfig
* Mon Jun 26 2000 Preston Brown <pbrown@redhat.com>
- move initscript to /etc/init.d, fix up post/preun/postun scripts.
* Sun Jun 26 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.3
* Sun Jun 18 2000 Matt Wilson <msw@redhat.com>
- use %%{_mandir}
* Fri Mar 03 2000 Tim Powers <timp@redhat.com>
- fixed startup script so that it doesn't put stuff in /var/lock/subsys.
Complains since anacronda turns itself off when it is run, and the file in
/var/lock/subsys isn't removed.
* Mon Feb 28 2000 Tim Powers <timp@redhat.com>
- fixed startup script, now it actually stops, gives status and restarts.
Fixes bug #9835
* Mon Feb 7 2000 Bill Nottingham <notting@redhat.com>
- handle compressed manpages
* Fri Feb 4 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- rebuild to get compressed man pages
- mark /etc/cron.daily/... as config files
* Wed Feb 02 2000 Cristian Gafton <gafton@redhat.com>
- fix annoying defines
- rebuild to update description and group
* Thu Jan 6 2000 Bernhard Rosenkränzer <bero@redhat.com>
- initial Red Hat package
* Wed Dec 29 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- Remove cron.hourly check (unusefull).
* Wed Nov 10 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- 2.1 from debian.
- Fix typo in initscripts.
* Thu Jul 22 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- Fix wrong entries in anacrontab.
- Add a /etc/rc.sysinit/ script
* Tue Apr 27 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- Fix bug with /var/spool/anacron/
* Sat Apr 10 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- First version mainly inspired from the Debian package.

View file

@ -1,11 +0,0 @@
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
1 65 cron.daily run-parts /etc/cron.daily
7 70 cron.weekly run-parts /etc/cron.weekly
30 75 cron.monthly run-parts /etc/cron.monthly

1
dead.package Normal file
View file

@ -0,0 +1 @@
Obsoleted by cronie-anacron as of F-12.

View file

@ -1,2 +0,0 @@
9fdfc50f5741643332722a9145146278 anacron_2.3.orig.tar.gz
094af5e05723d2c4924d60f73d738509 anacron.init