Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 112084 - www-servers/lighttpd init scripts should use --pidfile for start-stop-daemon
Summary: www-servers/lighttpd init scripts should use --pidfile for start-stop-daemon
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: www-servers Herd (OBSOLETE)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-10 09:07 UTC by Eric Brown
Modified: 2009-08-10 14:02 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Brown 2005-11-10 09:07:33 UTC
I needed to run multiple instances of lighttpd, and here's how I did it:

copy /etc/lighttpd.conf to /etc/lighttpd2.conf
copy /etc/init.d/lighttpd to /etc/init.d/lighttpd2

I had to modify the init script to use --pidfile ${PID_FILE} in order to get the
behavior I wanted (otherwise, it would tries to kill the process by the
executable name, not the PID).  In my eyes, it really just makes more sense to
use the PID file if we have it since it's more specific than killing per
executable name.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Eric Brown 2005-11-18 12:50:56 UTC
I am having trouble getting start-stop-daemon to work with lighttpd/pid files...

I think when lighttpd daemonizes, start-stop-daemon doesn't get returned the pid
(so I have empty pid files).  Does anyone know why this is happening and if
there's a better way to have init scripts control multiple lighttpd processes?
Comment 2 Eric Brown 2005-11-18 12:55:02 UTC
Solution:

set the server.pid-file variable in each lighttpd.conf you use... Then lighty
will write its own pids, and start-stop-daemon will be able to kill it via --pidfile
Comment 3 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2006-05-30 12:59:09 UTC
yes  - as you say. set an appropriate value of server.pid-file in each config file - copy the init script to use the new pid- and config-file.

closing the bug. please reopen if you meant something else.
Comment 4 Eric Anderson 2006-06-07 17:57:23 UTC
I was wanting to have multiple instances of lighttpd as well. I think that a note should be placed in the init script noting that the pid file should match the pid file in the lighttpd config.

In my opinion, a better solution would be to give the --make-pidfile argument to start-stop-daemon. This would create the wanted pidfile. The problem with this is that when lighttpd daemonizes itself the pid of the server process changes. So giving -D (don't daemonize) to lighttpd and --background to start-stop-daemon gives the correct pid.

start-stop-daemon --start --quiet --background \
                --pidfile ${LIGHTTPD_PID} --make-pidfile \
                --exec /usr/sbin/lighttpd -- -D -f ${LIGHTTPD_CONF}

That is the only change that would be made to the init script. Then the pid file can be removed from lighttpd.conf.
Comment 5 Walter 2009-08-10 14:02:18 UTC
I agree.

As a webserver, lighttpd is basic systems infrastructure.

Not elegantly supporting multiple instances out of the box is a bad thing.

In my case, I wanted multiple instances for testing purposes.

Manual modification to support this should be minimised by improving the init script as Eric suggested.

I don't think it's right to mark this bug as 'RESOLVED WORKSFORME'.