Supervise/daemontools conflicts with apache -D FOREGROUND

apache-2.2daemontools

Hoping that somebody can help us understand this behavior.

We've got a bunch of daemontools services under /etc/service/. One of the services controls apache, and the run script has this in it.

exec envdir /var/lib/supervise/wwwproxy/env setuidgid root bash <<-BASH
    ulimit -n 8192  # also increase the running user's file descriptor limit
    exec apache2 -f /path/to/demo_apache2.conf -D FOREGROUND
BASH 

We were having the problem that svc -d /etc/service/* actually had the effect of restarting all the services, it didn't take them down. We finally tracked it down to that one service, and found that svc -d /etc/service/apache2 would bring up any other service was down, including itself.

Changing FOREGROUND to NO_DAEMONIZE fixes the behavior, but we'd really like to understand what's going on. Can anybody explain why an svc -d on one service would bring an other service up?

Thanks for any clue you can offer.

Best Answer

For me -D NO_DAEMONIZE didn't work, I had to use -D NO_DETACH. (CentOS 6.3, Apache/2.2.15)

See also http://httpd.apache.org/docs/2.2/programs/httpd.html:

Also can be used to set certain less-common startup parameters including -DNO_DETACH (prevent the parent from forking) and -DFOREGROUND (prevent the parent from calling setsid() et al).

Related Topic