]> git.pld-linux.org Git - packages/couchdb.git/commitdiff
- new file: init script for couchdb
authorjaphy <japhy@pld-linux.org>
Sun, 8 Jun 2008 13:19:20 +0000 (13:19 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    couchdb.init -> 1.1

couchdb.init [new file with mode: 0644]

diff --git a/couchdb.init b/couchdb.init
new file mode 100644 (file)
index 0000000..36e3f0a
--- /dev/null
@@ -0,0 +1,124 @@
+#!/bin/sh
+#
+# couchdb      apache couchdb init script
+#
+# chkconfig:   345 85 25
+#
+# description: apache couchdb init script
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Set defaults
+COUCHDB_INI='/etc/apache-couchdb/couch.ini'
+COUCHDB_PID='/var/run/couchdb.pid'
+COUCHDB_USER='couchdb'
+COUCHDB_STDOUT='/dev/null'
+COUCHDB_STDERR='/dev/null'
+COUCHDB_RESPAWN='5'
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/couchdb ] && . /etc/sysconfig/couchdb
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down couchdb
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+start() {
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/couchdb ]; then
+               msg_starting couchdb
+                test -n $COUCHDB_PID \
+                    && touch $COUCHDB_PID \
+                    && chown $COUCHDB_USER $COUCHDB_PID
+               daemon --user $COUCHDB_USER /usr/bin/couchdb \
+                    -b -c "$COUCHDB_INI" -p "$COUCHDB_PID" \
+                    -o "$COUCHDB_STDOUT" -e "$COUCHDB_STDERR" \
+                    -r "$COUCHDB_RESPAWN"
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/couchdb
+       else
+               msg_already_running couchdb
+       fi
+}
+
+stop() {
+       if [ -f /var/lock/subsys/couchdb ]; then
+               # Stop daemons.
+               msg_stopping couchdb
+               killproc couchdb
+               killproc --pidfile $COUCHDB_PID couchdb -TERM
+               rm -f /var/lock/subsys/couchdb
+       else
+               msg_not_running couchdb
+       fi
+}
+
+reload() {
+       if [ -f /var/lock/subsys/couchdb ]; then
+               msg_reloading couchdb
+               killproc couchdb -HUP
+               killproc --pidfile $COUCHDB_PID couchdb -HUP
+               RETVAL=$?
+       else
+               msg_not_running couchdb
+               RETVAL=7
+       fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/couchdb ]; then
+               stop
+               start
+       else
+               msg_not_running couchdb
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+# include force-reload here if program allows reloading without restart
+# otherwise remove reload action and support force-reload as restart if running
+  reload|force-reload)
+       reload
+       ;;
+# use this one if program doesn't support reloading without restart
+  force-reload)
+       condrestart 7
+       ;;
+  status)
+       status couchdb
+       RETVAL=$?
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL
This page took 0.083803 seconds and 4 git commands to generate.