Hello, While packaging for Debian, I came across a worrying problem.
The PID file for CouchDB was located at: /var/run/couchdb.pid Originally, the SysV init script took care of creating this and changing the ownership so that it could be written to by the couchdb process. At some point, this changing of ownership was removed. The first time you try to run CouchDB from the SysV init script, it will complain about not being able to write to the PID file and die. I am guessing the solution to this is to touch it as root, and then change the ownership. You only need to do this once, and CouchDB will work flawlessly after that, presuming you don't remove it again. I am surprised no one has raised this as a bug! Anyway, I've put in a fix to trunk which is to make the PID file sit inside a CouchDB specific directory. This should be owned by the couchdb user, and I have added instructions to the README. This essentially fixes the problem without having to add in any additional code to the SysV script. I have back-ported this patch to my Debian package. So, the question here is... should this be back-ported to a 0.9.1 release? Best, On Thu, Apr 02, 2009 at 05:40:55PM -0000, [email protected] wrote: > Author: nslater > Date: Thu Apr 2 17:40:54 2009 > New Revision: 761355 > > URL: http://svn.apache.org/viewvc?rev=761355&view=rev > Log: > reworked the pid file > > Modified: > couchdb/trunk/bin/couchdb.tpl.in > couchdb/trunk/configure.ac > couchdb/trunk/etc/init/couchdb.tpl.in > couchdb/trunk/var/Makefile.am > > Modified: couchdb/trunk/bin/couchdb.tpl.in > URL: > http://svn.apache.org/viewvc/couchdb/trunk/bin/couchdb.tpl.in?rev=761355&r1=761354&r2=761355&view=diff > ============================================================================== > --- couchdb/trunk/bin/couchdb.tpl.in (original) > +++ couchdb/trunk/bin/couchdb.tpl.in Thu Apr 2 17:40:54 2009 > @@ -27,7 +27,7 @@ > DEFAULT_INI_FILE=%localconfdir%/%defaultini% > LOCAL_INI_FILE=%localconfdir%/%localini% > > -PID_FILE=%localstatedir%/run/couchdb.pid > +PID_FILE=%localstatedir%/run/couchdb/couchdb.pid > > STDOUT_FILE=couchdb.stdout > STDERR_FILE=couchdb.stderr > > Modified: couchdb/trunk/configure.ac > URL: > http://svn.apache.org/viewvc/couchdb/trunk/configure.ac?rev=761355&r1=761354&r2=761355&view=diff > ============================================================================== > --- couchdb/trunk/configure.ac (original) > +++ couchdb/trunk/configure.ac Thu Apr 2 17:40:54 2009 > @@ -240,6 +240,7 @@ > AC_SUBST([locallibdir], [${libdir}/${package_identifier}]) > AC_SUBST([localstatelibdir], [${localstatedir}/lib/${package_identifier}]) > AC_SUBST([localstatelogdir], [${localstatedir}/log/${package_identifier}]) > +AC_SUBST([localstaterundir], [${localstatedir}/run/${package_identifier}]) > AC_SUBST([locallibbindir], [${locallibdir}/bin]) > AC_SUBST([localerlangbindir], [${locallibdir}/erlang/bin]) > AC_SUBST([localerlanglibdir], [${locallibdir}/erlang/lib]) > > Modified: couchdb/trunk/etc/init/couchdb.tpl.in > URL: > http://svn.apache.org/viewvc/couchdb/trunk/etc/init/couchdb.tpl.in?rev=761355&r1=761354&r2=761355&view=diff > ============================================================================== > --- couchdb/trunk/etc/init/couchdb.tpl.in (original) > +++ couchdb/trunk/etc/init/couchdb.tpl.in Thu Apr 2 17:40:54 2009 > @@ -63,9 +63,6 @@ > # Start Apache CouchDB as a background process. > > command="$COUCHDB -b" > - if test -n "$COUCHDB_PID_FILE"; then > - command="$command -p $COUCHDB_PID_FILE" > - fi > if test -n "$COUCHDB_STDOUT_FILE"; then > command="$command -o $COUCHDB_STDOUT_FILE" > fi > > Modified: couchdb/trunk/var/Makefile.am > URL: > http://svn.apache.org/viewvc/couchdb/trunk/var/Makefile.am?rev=761355&r1=761354&r2=761355&view=diff > ============================================================================== > --- couchdb/trunk/var/Makefile.am (original) > +++ couchdb/trunk/var/Makefile.am Thu Apr 2 17:40:54 2009 > @@ -14,10 +14,10 @@ > if test ! "$(mkdir_p)" = ""; then \ > $(mkdir_p) "$(DESTDIR)$(localstatelibdir)"; \ > $(mkdir_p) "$(DESTDIR)$(localstatelogdir)"; \ > - $(mkdir_p) "$(DESTDIR)$(localstatedir)/run"; \ > + $(mkdir_p) "$(DESTDIR)$(localstaterundir)"; \ > else \ > echo "WARNING: You may have to create these directories by hand."; \ > mkdir -p "$(DESTDIR)$(localstatelibdir)"; \ > mkdir -p "$(DESTDIR)$(localstatelogdir)"; \ > - mkdir -p "$(DESTDIR)$(localstatedir)/run"; \ > + mkdir -p "$(DESTDIR)$(localstaterundir)"; \ > fi > > -- Noah Slater, http://tumbolia.org/nslater
