Author: glen                         Date: Mon Jul 12 11:11:57 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- unify

---- Files affected:
packages/mailgraph:
   mailgraph.init (1.12 -> 1.13) 

---- Diffs:

================================================================
Index: packages/mailgraph/mailgraph.init
diff -u packages/mailgraph/mailgraph.init:1.12 
packages/mailgraph/mailgraph.init:1.13
--- packages/mailgraph/mailgraph.init:1.12      Sun Mar  5 14:26:28 2006
+++ packages/mailgraph/mailgraph.init   Mon Jul 12 13:11:52 2010
@@ -5,6 +5,8 @@
 #
 # chkconfig:   345 55 45
 # description: mailgraph watch postfix logfiles and generate www statistics
+#
+# $Id$
 
 # Source function library.
 . /etc/rc.d/init.d/functions
@@ -15,54 +17,80 @@
 # Get service config
 [ -f /etc/sysconfig/mailgraph ] && . /etc/sysconfig/mailgraph
 
+start() {
+       # Check if the service is already running?
+       if [ -f /var/lock/subsys/mailgraph ]; then
+               msg_already_running "mailgraph"
+               return
+       fi
+
+       if [ "${RBL_IS_SPAM}" = "yes" ]; then
+               STARTUP_OPTIONS="${STARTUP_OPTIONS} --rbl-is-spam"
+       fi
+       if [ "${VIRBL_IS_VIRUS}" = "yes" ]; then
+               STARTUP_OPTIONS="${STARTUP_OPTIONS} --virbl-is-virus"
+       fi
+
+       msg_starting "mailgraph"
+       daemon --user stats /usr/sbin/mailgraph.pl -d \
+               ${STARTUP_OPTIONS} \
+               --daemon-rrd=/var/lib/mailgraph \
+               --daemon-pid=/var/lib/mailgraph/mailgraph.pid \
+               $([ -n "$MAILLOG_FILE" ] && echo -l $MAILLOG_FILE ) 2>&1
+       RETVAL=$?
+       if [ $RETVAL -eq 0 ] ; then
+               touch /var/lock/subsys/mailgraph
+               ln -sf /var/lib/mailgraph/mailgraph.pid /var/run/mailgraph.pid
+       fi
+}
+
+stop() {
+       if [ ! -f /var/lock/subsys/mailgraph ]; then
+               msg_not_running "mailgraph"
+               return
+       fi
+
+       msg_stopping "mailgraph"
+       killproc mailgraph
+       rm -f /var/lock/subsys/mailgraph /var/run/mailgraph.pid 
/var/lib/mailgraph/mailgraph.pid >/dev/null 2>&1
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/mailgraph ]; then
+               msg_not_running "mailgraph"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-       # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/mailgraph ]; then
-               if [ "${RBL_IS_SPAM}" = "yes" ]; then
-                       STARTUP_OPTIONS="${STARTUP_OPTIONS} --rbl-is-spam"
-               fi
-               if [ "${VIRBL_IS_VIRUS}" = "yes" ]; then
-                       STARTUP_OPTIONS="${STARTUP_OPTIONS} --virbl-is-virus"   
-               fi
-               
-               msg_starting mailgraph
-               daemon --user stats /usr/sbin/mailgraph.pl -d \
-                       ${STARTUP_OPTIONS} \
-                       --daemon-rrd=/var/lib/mailgraph \
-                       --daemon-pid=/var/lib/mailgraph/mailgraph.pid \
-                       $([ -n "$MAILLOG_FILE" ] && echo -l $MAILLOG_FILE ) 2>&1
-               RETVAL=$?
-               if [ $RETVAL -eq 0 ] ; then
-                       touch /var/lock/subsys/mailgraph
-                       ln -sf /var/lib/mailgraph/mailgraph.pid 
/var/run/mailgraph.pid
-               fi
-       else
-               msg_already_running mailgraph
-       fi
+       start
        ;;
   stop)
-       if [ -f /var/lock/subsys/mailgraph ]; then
-               msg_stopping mailgraph
-               killproc mailgraph
-               rm -f /var/lock/subsys/mailgraph /var/run/mailgraph.pid 
/var/lib/mailgraph/mailgraph.pid >/dev/null 2>&1
-       else
-               msg_not_running mailgraph
-       fi
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status mailgraph.pl
        exit $?
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
-       ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mailgraph/mailgraph.init?r1=1.12&r2=1.13&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to