rpms/anacron/F-9 anacron-2.3-fdclose.patch, 1.1, 1.2 anacron-2.3-mail-content-type-77108.patch, 1.1, 1.2 anacron.init, 1.15, 1.16 anacron.spec, 1.48, 1.49

Marcela Mašláňová mmaslano at fedoraproject.org
Thu Oct 23 13:47:46 UTC 2008


Author: mmaslano

Update of /cvs/pkgs/rpms/anacron/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15388

Modified Files:
	anacron-2.3-fdclose.patch 
	anacron-2.3-mail-content-type-77108.patch anacron.init 
	anacron.spec 
Log Message:
* Thu Oct 23 2008 Marcela Mašláňová <mmaslano at redhat.com> 2.3-62
- rewrite init script - using fedora guidelines SysVInitScript


anacron-2.3-fdclose.patch:

Index: anacron-2.3-fdclose.patch
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/F-9/anacron-2.3-fdclose.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- anacron-2.3-fdclose.patch	12 Sep 2006 11:34:21 -0000	1.1
+++ anacron-2.3-fdclose.patch	23 Oct 2008 13:47:16 -0000	1.2
@@ -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 @@
     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 @@
  
      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 @@
  }
  
  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 @@
  	/* 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);

anacron-2.3-mail-content-type-77108.patch:

Index: anacron-2.3-mail-content-type-77108.patch
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/F-9/anacron-2.3-mail-content-type-77108.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- anacron-2.3-mail-content-type-77108.patch	9 Sep 2004 03:00:12 -0000	1.1
+++ anacron-2.3-mail-content-type-77108.patch	23 Oct 2008 13:47:16 -0000	1.2
@@ -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 @@
  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 ");


Index: anacron.init
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/F-9/anacron.init,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- anacron.init	22 Sep 2008 16:08:47 -0000	1.15
+++ anacron.init	23 Oct 2008 13:47:16 -0000	1.16
@@ -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
 }
 
-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
+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)
+        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


Index: anacron.spec
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/F-9/anacron.spec,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- anacron.spec	22 Sep 2008 16:08:47 -0000	1.48
+++ anacron.spec	23 Oct 2008 13:47:16 -0000	1.49
@@ -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 @@
 %attr(755,root,root) %dir /etc/cron.weekly/0anacron
 
 %changelog
+* Thu Oct 23 2008 Marcela Mašláňová <mmaslano at redhat.com> 2.3-62
+- rewrite init script - using fedora guidelines SysVInitScript
+
 * Mon Sep 22 2008 Marcela Maslanova <mmaslano at redhat.com> 2.3-61
 - correct init script - really kill anacron
 
@@ -117,7 +120,7 @@
 
 * Thu Feb 28 2008 Marcela Maslanova <mmaslano at 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 at fedoraproject.org> - 2.3-58




More information about the scm-commits mailing list