rpms/cronie/devel init.patch,NONE,1.1 cronie.spec,1.12,1.13

Marcela Mašláňová mmaslano at fedoraproject.org
Fri Oct 24 12:59:11 UTC 2008


Author: mmaslano

Update of /cvs/pkgs/rpms/cronie/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14863

Modified Files:
	cronie.spec 
Added Files:
	init.patch 
Log Message:
* Fri Oct 24 2008 Marcela Mašláňová <mmaslano at redhat.com> - 1.2-4
- update init script


init.patch:

--- NEW FILE init.patch ---
diff -up cronie-1.2/cronie.init.old cronie-1.2/cronie.init
--- cronie-1.2/cronie.init.old	2008-06-26 14:56:00.000000000 +0200
+++ cronie-1.2/cronie.init	2008-10-24 14:46:59.000000000 +0200
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/sh
 #
 # crond          Start/Stop the cron clock daemon.
 #
@@ -7,9 +7,19 @@
 #              programs at periodic scheduled times. vixie cron adds a \
 #              number of features to the basic UNIX cron, including better \
 #              security and more powerful configuration options.
-# processname: crond
-# config: /etc/crontab
-# pidfile: /var/run/crond.pid
+
+### BEGIN INIT INFO
+# Provides: crond crontab
+# Required-Start: $local_fs $syslog
+# Required-Stop: $local_fs $syslog
+# Default-Start:  2345
+# Default-Stop: 90
+# Short-Description: run cron daemon
+# Description: cron is a standard UNIX program that runs user-specified 
+#              programs at periodic scheduled times. vixie cron adds a 
+#              number of features to the basic UNIX cron, including better 
+#              security and more powerful configuration options.
+### END INIT INFO
 
 [ -f /etc/sysconfig/crond ] || { 
     [ "$1" = "status" ] && exit 4 || exit 6 
@@ -17,82 +27,104 @@
 
 RETVAL=0
 prog="crond"
-CROND=/usr/sbin/crond
-LOCK_FILE=/var/lock/subsys/crond
+exec=/usr/sbin/crond
+lockfile=/var/lock/subsys/crond
+config=/etc/sysconfig/crond
 
 # Source function library.
-. /etc/init.d/functions
+. /etc/rc.d/init.d/functions
 
-# set sysconfig settings
-[ -f /etc/sysconfig/crond ] && . /etc/sysconfig/crond
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
 
 # validate mail
 t=${CRON_VALIDATE_MAILRCPTS:-UNSET}
 [ "$t" != "UNSET" ] && export CRON_VALIDATE_MAILRCPTS="$t"
- 
-prog="crond"
 
 start() {
-	echo -n $"Starting $prog: "
-	daemon $prog $CRONDARGS && success || failure
-	RETVAL=$?
-	[ "$RETVAL" = 0 ] && touch $LOCK_FILE
-	echo
+    [ -x $exec ] || exit 5
+    [ -f $config ] || exit 6
+    echo -n $"Starting $prog: "
+    daemon $prog $CRONDARGS && success || failure
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
 }
 
 stop() {
-	echo -n $"Stopping $prog: "
-	if [ -n "`pidfileofproc $CROND`" ]; then
-		killproc $CROND
+    echo -n $"Stopping $prog: "
+	if [ -n "`pidfileofproc $exec`" ]; then
+		killproc $exec
 		RETVAL=3
 	else
 		failure $"Stopping $prog"
 	fi
-	RETVAL=$?
-	[ "$RETVAL" = 0 ] && rm -f $LOCK_FILE
-	echo
-}	
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
 
 reload() {
 	echo -n $"Reloading $prog: "
-	if [ -n "`pidfileofproc $CROND`" ]; then
-		killproc $CROND -HUP
+	if [ -n "`pidfileofproc $exec`" ]; then
+		killproc $exec -HUP
 	else
 		failure $"Reloading $prog"
 	fi
-	RETVAL=$?
+	retval=$?
 	echo
-}	
+}
+
+force_reload() {
+	# new configuration takes effect after restart
+    restart
+}
+
+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
-	;;
-  restart)
-	stop
-  	start
-	;;
-  reload)
-  	reload
-	;;
-  status)
-	status $CROND
-	;;
-  condrestart)
-    if [ -f  $LOCK_FILE ]; then
-        if [ "$RETVAL" = 0 ]; then
-            stop
-            sleep 3
-            start
-        fi
-    fi
-    ;;
-  *)
-	echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
-	RETVAL=3
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        rh_status_q || exit 7
+        $1
+        ;;
+    force-reload)
+        force_reload
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+        exit 2
 esac
-exit $RETVAL
+exit $?
 


Index: cronie.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cronie/devel/cronie.spec,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- cronie.spec	25 Sep 2008 12:49:00 -0000	1.12
+++ cronie.spec	24 Oct 2008 12:58:41 -0000	1.13
@@ -6,13 +6,13 @@
 Summary: Cron daemon for executing programs at set times
 Name: cronie
 Version: 1.2
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: MIT and BSD
 Group: System Environment/Base
 URL: https://fedorahosted.org/cronie
 #Source0: https://fedorahosted.org/cronie/%{name}-%{version}.tar.gz
 Source0: http://mmaslano.fedorapeople.org/cronie/%{name}-%{version}.tar.gz
-
+Patch0:	init.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Requires: syslog, bash >= 2.0
@@ -47,6 +47,7 @@
 
 %prep
 %setup -q
+%patch0 -p1 
 
 %build
 
@@ -126,6 +127,9 @@
 %config(noreplace) %{_sysconfdir}/cron.deny
 
 %changelog
+* Fri Oct 24 2008 Marcela Mašláňová <mmaslano at redhat.com> - 1.2-4
+- update init script
+
 * Thu Sep 25 2008 Marcela Maslanova <mmaslano at redhat.com> - 1.2-3
 - add sendmail file into requirement, cause it's needed some MTA
 




More information about the scm-commits mailing list