rpms/anacron/devel anacron.init,1.5,1.6 anacron.spec,1.17,1.18

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Apr 14 00:49:57 UTC 2006


Author: jvdias

Update of /cvs/dist/rpms/anacron/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv7994

Modified Files:
	anacron.init anacron.spec 
Log Message:
fix bug 188403


Index: anacron.init
===================================================================
RCS file: /cvs/dist/rpms/anacron/devel/anacron.init,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- anacron.init	11 Jan 2006 22:03:07 -0000	1.5
+++ anacron.init	14 Apr 2006 00:49:54 -0000	1.6
@@ -3,32 +3,49 @@
 #
 # 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=$?
-    touch $LOCKFILE
+    if [ $RETVAL -ne 0 ]; then
+	failure;
+    fi;
     echo
     return $RETVAL
 }
 
 stop() {
-    if test "x`pidof anacron`" != x; then
-	echo -n $"Stopping $prog: "
+    echo -n $"Stopping $prog: "
+    if [ -f $PIDFILE ]; then
 	killproc anacron
-	echo
+	RETVAL=$?
+	if [ $RETVAL -ne 0 ]; then 
+	    failure;
+	fi;
+    else
+	RETVAL=1
+	failure;
     fi
-    RETVAL=$?
-    rm -f $LOCKFILE
+    echo
     return $RETVAL
 }
 
@@ -44,10 +61,12 @@
 	status)
 	    status anacron
 	    ;;
+
 	restart)
 	    stop
 	    start
 	    ;;
+
 	condrestart)
 	    if [ -f $LOCKFILE ]; then
 		stop


Index: anacron.spec
===================================================================
RCS file: /cvs/dist/rpms/anacron/devel/anacron.spec,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- anacron.spec	11 Feb 2006 01:36:12 -0000	1.17
+++ anacron.spec	14 Apr 2006 00:49:55 -0000	1.18
@@ -1,7 +1,7 @@
 Summary: A cron-like program that can run jobs lost during downtime.
 Name: anacron
 Version: 2.3
-Release: 36.1
+Release: 38.1
 License: GPL
 Group: System Environment/Base
 Source: ftp://ftp.debian.org/debian/pool/main/a/anacron/%{name}_%{version}.orig.tar.gz
@@ -11,6 +11,7 @@
 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
 Requires: /bin/sh
 Requires: crontabs
 Prereq: /sbin/chkconfig
@@ -37,6 +38,7 @@
 %patch1 -p1 -b .charset
 %patch2 -p1 -b .noconst
 %patch3 -p1 -b .mailto
+%patch4 -p1 -b .lock-files
 
 %build
 make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
@@ -110,6 +112,18 @@
 %config /etc/cron.weekly/0anacron
 
 %changelog
+* Thu Apr 13 2006 Jason Vas Dias <jvdias at 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 at redhat.com> - 2.3-36.1
 - bump again for double-long bug on ppc(64)
 




More information about the fedora-cvs-commits mailing list