summaryrefslogtreecommitdiff
path: root/community/couchdb/rc-script.patch
blob: d38f4dc6cdcf14b1aacc595fe5870664e2eb8e7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
--- couchdb.org	2011-04-01 19:56:32.000000000 +0000
+++ couchdb	2011-04-01 19:59:17.000000000 +0000
@@ -1,4 +1,7 @@
-#!/bin/sh -e
+#!/bin/bash
+#general config
+. /etc/rc.conf
+. /etc/rc.d/functions
 
 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
 # use this file except in compliance with the License. You may obtain a copy of
@@ -29,7 +32,7 @@
 NAME=couchdb
 SCRIPT_NAME=`basename $0`
 COUCHDB=/usr/bin/couchdb
-CONFIGURATION_FILE=/etc/default/couchdb
+CONFIGURATION_FILE=/etc/conf.d/couchdb
 RUN_DIR=/var/run/couchdb
 LSB_LIBRARY=/lib/lsb/init-functions
 
@@ -61,8 +63,9 @@
 fi
 
 start_couchdb () {
-    # Start Apache CouchDB as a background process.
+    stat_busy "Starting the CouchDB daemon"
 
+    [ -d /var/run/couchdb ] || mkdir -p /var/run/couchdb
     command="$COUCHDB -b"
     if test -n "$COUCHDB_STDOUT_FILE"; then
         command="$command -o $COUCHDB_STDOUT_FILE"
@@ -79,38 +82,38 @@
     mkdir -p "$RUN_DIR"
     if test -n "$COUCHDB_USER"; then
         chown $COUCHDB_USER "$RUN_DIR"
-        if su $COUCHDB_USER -c "$command" > /dev/null; then
-            return $SCRIPT_OK
+        if su $COUCHDB_USER -s /bin/bash -c "$command" > /dev/null; then
+            stat_done
         else
-            return $SCRIPT_ERROR
+            stat_fail
         fi
     else
         if $command > /dev/null; then
-            return $SCRIPT_OK
+            stat_done
         else
-            return $SCRIPT_ERROR
+            stat_fail
         fi
     fi
 }
 
 stop_couchdb () {
-    # Stop the running Apache CouchDB process.
+    stat_busy "Stopping the CouchDB daemon"
 
     command="$COUCHDB -d"
     if test -n "$COUCHDB_OPTIONS"; then
         command="$command $COUCHDB_OPTIONS"
     fi
     if test -n "$COUCHDB_USER"; then
-        if su $COUCHDB_USER -c "$command" > /dev/null; then
-            return $SCRIPT_OK
+        if su $COUCHDB_USER -s /bin/bash -c "$command" > /dev/null; then
+            stat_done
         else
-            return $SCRIPT_ERROR
+            stat_fail
         fi
     else
         if $command > /dev/null; then
-            return $SCRIPT_OK
+            stat_done
         else
-            return $SCRIPT_ERROR
+            stat_fail
         fi
     fi
 }
@@ -118,7 +121,7 @@
 display_status () {
     # Display the status of the running Apache CouchDB process.
 
-    $COUCHDB -s
+    $COUCHDB $COUCHDB_OPTIONS -s
 }
 
 parse_script_option_list () {