SOURCES: spampd.init - use functions add try-restart, force-reload

glen glen at pld-linux.org
Mon Oct 20 21:36:36 CEST 2008


Author: glen                         Date: Mon Oct 20 19:36:36 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions add try-restart, force-reload

---- Files affected:
SOURCES:
   spampd.init (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: SOURCES/spampd.init
diff -u SOURCES/spampd.init:1.3 SOURCES/spampd.init:1.4
--- SOURCES/spampd.init:1.3	Thu Jul 28 14:33:25 2005
+++ SOURCES/spampd.init	Mon Oct 20 21:36:29 2008
@@ -2,7 +2,7 @@
 #
 # This script starts and stops the spampd daemon
 #
-# chkconfig: 2345 80 20
+# chkconfig: 345 80 20
 #
 # description: spampd is a daemon process which uses SpamAssassin to check
 #              email messages for SPAM.
@@ -28,9 +28,7 @@
 	exit 0
 fi
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/spampd ]; then
 		msg_starting spampd
@@ -42,8 +40,9 @@
 	else
 		msg_already_running spampd
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	# Stop daemons.
 	if [ -f /var/lock/subsys/spampd ]; then
 		# Stop daemons.
@@ -53,22 +52,49 @@
 	else
 		msg_not_running spampd
 	fi
+}
+
+
+condrestart() {
+	if [ -f /var/lock/subsys/spampd ]; then
+		stop
+		start
+	else
+		msg_not_running spampd
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   restart)
-	$0 stop
-	$0 start
-	exit $?
+	stop
+	start
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
 	;;
   status)
 	status spampd
 	RETVAL=$?
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|status}"
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
 	exit 3
 esac
 
 exit $RETVAL
-
-# This must be last line !
-# vi:syntax=sh:tw=78:ts=4:sw=4
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/spampd.init?r1=1.3&r2=1.4&f=u



More information about the pld-cvs-commit mailing list