couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rand...@apache.org
Subject svn commit: r1146997 - /couchdb/trunk/etc/init/couchdb.tpl.in
Date Fri, 15 Jul 2011 07:54:22 GMT
Author: randall
Date: Fri Jul 15 07:54:22 2011
New Revision: 1146997

URL: http://svn.apache.org/viewvc?rev=1146997&view=rev
Log:
always pass options in init script (COUCHDB-128)

Modified:
    couchdb/trunk/etc/init/couchdb.tpl.in

Modified: couchdb/trunk/etc/init/couchdb.tpl.in
URL: http://svn.apache.org/viewvc/couchdb/trunk/etc/init/couchdb.tpl.in?rev=1146997&r1=1146996&r2=1146997&view=diff
==============================================================================
--- couchdb/trunk/etc/init/couchdb.tpl.in (original)
+++ couchdb/trunk/etc/init/couchdb.tpl.in Fri Jul 15 07:54:22 2011
@@ -60,32 +60,19 @@ if test -r $LSB_LIBRARY; then
     . $LSB_LIBRARY
 fi
 
-start_couchdb () {
-    # Start Apache CouchDB as a background process.
-
-    command="$COUCHDB -b"
-    if test -n "$COUCHDB_STDOUT_FILE"; then
-        command="$command -o $COUCHDB_STDOUT_FILE"
-    fi
-    if test -n "$COUCHDB_STDERR_FILE"; then
-        command="$command -e $COUCHDB_STDERR_FILE"
-    fi
-    if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then
-        command="$command -r $COUCHDB_RESPAWN_TIMEOUT"
-    fi
+run_command () {
+    command="$1"
     if test -n "$COUCHDB_OPTIONS"; then
         command="$command $COUCHDB_OPTIONS"
     fi
-    mkdir -p "$RUN_DIR"
     if test -n "$COUCHDB_USER"; then
-        chown $COUCHDB_USER "$RUN_DIR"
-        if su $COUCHDB_USER -c "$command" > /dev/null; then
+        if su $COUCHDB_USER -c "$command"; then
             return $SCRIPT_OK
         else
             return $SCRIPT_ERROR
         fi
     else
-        if $command > /dev/null; then
+        if $command; then
             return $SCRIPT_OK
         else
             return $SCRIPT_ERROR
@@ -93,32 +80,33 @@ start_couchdb () {
     fi
 }
 
-stop_couchdb () {
-    # Stop the running Apache CouchDB process.
+start_couchdb () {
+    # Start Apache CouchDB as a background process.
 
-    command="$COUCHDB -d"
-    if test -n "$COUCHDB_OPTIONS"; then
-        command="$command $COUCHDB_OPTIONS"
+    mkdir -p "$RUN_DIR"
+    command="$COUCHDB -b"
+    if test -n "$COUCHDB_STDOUT_FILE"; then
+        command="$command -o $COUCHDB_STDOUT_FILE"
     fi
-    if test -n "$COUCHDB_USER"; then
-        if su $COUCHDB_USER -c "$command" > /dev/null; then
-            return $SCRIPT_OK
-        else
-            return $SCRIPT_ERROR
-        fi
-    else
-        if $command > /dev/null; then
-            return $SCRIPT_OK
-        else
-            return $SCRIPT_ERROR
-        fi
+    if test -n "$COUCHDB_STDERR_FILE"; then
+        command="$command -e $COUCHDB_STDERR_FILE"
+    fi
+    if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then
+        command="$command -r $COUCHDB_RESPAWN_TIMEOUT"
     fi
+    run_command "$command" > /dev/null
+}
+
+stop_couchdb () {
+    # Stop the running Apache CouchDB process.
+
+    run_command "$COUCHDB -d" > /dev/null
 }
 
 display_status () {
     # Display the status of the running Apache CouchDB process.
 
-    $COUCHDB -s
+    run_command "$COUCHDB -s"
 }
 
 parse_script_option_list () {



Mime
View raw message