Eray Aslan: > On Tue, Mar 06, 2012 at 02:30:59PM -0500, Michael Orlitzky wrote: > > either. Right now the problem is easy to understand: half of the time on > > Gentoo, the startup "OK" is meaningless. Everyone knows this, and > > figures out how to deal with it quickly: > > > > backup2 ~ # /etc/init.d/postfix stop > > * Stopping postfix (/etc/postfix)... [ !! ] > > * ERROR: postfix failed to stop > > You get this error because your system thinks postfix is running because > the init script exited successfully because postfix start exited > successfully (but postfix bailed out with wrong configuration). With > postfix status check added, the init script, hence your system, would > work as expected and you won't be getting the above or similar errors, > i.e. there would be no need for the zap & start workaround. > > Downside: > It would take ~1sec more to start up postfix *for everyone* - one has to > wait a bit before running postfix status after postfix start.
So you need a way for "postfix start" that returns status 0 if the master(8) daemon initalizes successfully, and non-zero otherwise. I think this can be done by starting the master as a foreground process. The foreground master forks a child process that will become the master daemon that runs as a background process. The foreground master process waits for the "all is OK" signal from the child process. When that happens, the foreground process terminates with a 0 status, causing "postfix start" to return a 0 status. This will normally take a fraction of a second. In case of problems (no response from child, child terminates) the foreground process terminates with non-zero status, and "postfix start" reports an error, and returns a non-zero exit status. Will that work? Wietse