On Mon, May 23, 2011 at 7:07 PM, Noah Slater <[email protected]> wrote: > > On 23 May 2011, at 17:47, till wrote: > >> I think su -c foo etc. is fundamentally wrong. > > Why? > >> In the end, it's why there's start-stop-daemon. > > This is one solution to the problem of starting and stopping daemons. There > are many solutions. We have one already. One that has been working for a > number of years. The system infrastructure has been one of the most stable > parts of CouchDB since it was originally added. > >> foo:~# su couchdb -c /usr/local/bin/couchdb -b -o /dev/null -e /dev/null -r 5 > > In the script, we have: > > su $COUCHDB_USER -c "$command" > > So your example will fail because it is not quoted. > >> foo:~# su couchdb -c "/usr/local/bin/couchdb -b -o /dev/null -e /dev/null -r >> 5" >> foo:~# echo $? >> 127 > > So there's an error starting CouchDB. What is it?
I really copied everything that was output. ;-) You tell me what 127 is. I think it's an exit code from su. > Try this instead, and report back what you see: > > su couchdb -c "/usr/local/bin/couchdb -b -o couchdb.out -e couchdb.err -r 5" > echo $? > cat couchdb.out > cat couchdb.err I think since the 127 comes from su, it doesn't even get to create .out and .err. I see them nowhere. Even after changing it to /tmp/couchdb.out (etc.). Googling says, "127 - a command could not be found", but I was unable to find a dedicated list of exit codes related to su. Til
