You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2010/03/02 19:52:06 UTC

svn commit: r918149 - /incubator/trafficserver/traffic/trunk/rc/trafficserver.in

Author: zwoop
Date: Tue Mar  2 18:52:05 2010
New Revision: 918149

URL: http://svn.apache.org/viewvc?rev=918149&view=rev
Log:
TS-225: Fix startup script for SUSE, and also improve some functionality on Fedora/RHEL.
	Review: George P.

Modified:
    incubator/trafficserver/traffic/trunk/rc/trafficserver.in

Modified: incubator/trafficserver/traffic/trunk/rc/trafficserver.in
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/rc/trafficserver.in?rev=918149&r1=918148&r2=918149&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/rc/trafficserver.in (original)
+++ incubator/trafficserver/traffic/trunk/rc/trafficserver.in Tue Mar  2 18:52:05 2010
@@ -114,18 +114,15 @@
 # Ubuntu: Load the VERBOSE setting and other rcS variables
 [ -f /etc/default/rcS ] && . /etc/default/rcS
 
+# Suse: load rc.status
+[ -f /etc/rc.status ] && . /etc/rc.status
 
-if [ -r /etc/rc.d/init.d/functions ]; then
 # Fedora: make avail helper functions 'action', 'killproc', 'status', etc
-    . /etc/rc.d/init.d/functions
-elif [ -r /lib/lsb/init-functions ]; then
+[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions
+
 # Ubuntu: Define LSB log_* functions.
 #         Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
-    . /lib/lsb/init-functions
-else
-    echo "This script needs to be ported to this OS"
-    exit 1
-fi
+[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions
 
 
 #
@@ -240,7 +237,11 @@
 		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
 	    esac
         elif [ "$DISTRIB_ID" = "fedora" -o "$DISTRIB_ID" = "redhat" ]; then
-            action "Starting $prog:" forkdaemon $TC_DAEMON $TC_DAEMON_ARGS
+            action "Starting ${TS_PACKAGE_NAME}:" forkdaemon $TC_DAEMON $TC_DAEMON_ARGS
+        elif [ "$DISTRIB_ID" = "suse" ]; then
+	    echo -n "Starting ${TS_PACKAGE_NAME}"
+            startproc -p $TC_PIDFILE $TC_DAEMON $TC_DAEMON_ARGS
+	    rc_status -v
         else
             echo "This script needs to be ported to this OS"
             exit 1
@@ -255,9 +256,19 @@
 		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
 	    esac
         elif [ "$DISTRIB_ID" = "fedora" -o "$DISTRIB_ID" = "redhat" ]; then
-            action "Stopping $prog:" killproc -p $TC_PIDFILE $TC_DAEMON
-            action "Stopping $prog:" killproc -p $TM_PIDFILE $TM_DAEMON
-            action "Stopping $prog:" killproc -p $TS_PIDFILE $TS_DAEMON
+            action "Stopping ${TC_NAME}:" killproc -p $TC_PIDFILE $TC_DAEMON
+            action "Stopping ${TM_NAME}:" killproc -p $TM_PIDFILE $TM_DAEMON
+            action "Stopping ${TS_NAME}:" killproc -p $TS_PIDFILE $TS_DAEMON
+        elif [ "$DISTRIB_ID" = "suse" ]; then
+	    echo -n "Stopping ${TC_NAME}"
+            killproc -p $TC_PIDFILE $TC_DAEMON
+	    rc_status -v
+	    echo -n "Stopping ${TM_NAME}"
+            killproc -p $TM_PIDFILE $TM_DAEMON
+	    rc_status -v
+	    echo -n "Stopping ${TS_NAME}"
+            killproc -p $TS_PIDFILE $TS_DAEMON
+	    rc_status -v
         else
             echo "This script needs to be ported to this OS"
             exit 1
@@ -294,18 +305,20 @@
 		    log_end_msg 1
 		    ;;
 	    esac
-        elif [ "$DISTRIB_ID" = "fedora" -o "$DISTRIB_ID" = "redhat" ]; then
+        else
+	    # This is the typical process for restart
             $0 'stop'
             $0 'start'
-        else
-            echo "This script needs to be ported to this OS"
-            exit 1
-        fi
+         fi
 	;;
   status)
         if [ "$DISTRIB_ID" = "fedora" -o "$DISTRIB_ID" = "redhat" ]; then
-            status -p $PIDFILE $PROGRAM
-        else
+            status -p $TC_PIDFILE $TC_NAME
+        elif [  "$DISTRIB_ID" = "suse" ]; then
+            echo -n "Checking for service ${DM}: "
+            checkproc -p $TC_PIDFILE $TC_NAME
+            rc_status -v
+	else
             echo "This script needs to be ported to this OS"
             exit 1
         fi
@@ -324,11 +337,11 @@
     ;;
   *)
         if [ "$DISTRIB_ID" = "ubuntu" -o "$DISTRIB_ID" = "debian" ] ; then
-	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
-	#echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
 	    echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
         elif [ "$DISTRIB_ID" = "fedora" -o "$DISTRIB_ID" = "redhat" ]; then
             echo "Usage: $0 {start|stop|status|restart|condrestart}"
+        elif [ "$DISTRIB_ID" = "suse" ]; then
+            echo "Usage: $0 {start|stop|restart|status}"
         else
             echo "This script needs to be ported to this OS"
             exit 1