Hi,
> The "problem" is more of that distribution like Ubuntu and Redhat are
> moving to "upstart" for boot and starting services/daemons. The main
> difference for the started services is that upstart need the program
> to *not* daemonize or terminate itself because status is checked
> directly to do respawn and other things if necessary and not by
> monitoring a PID like it was with sys-v. So basically to get Postfix
> upstart compatibel a "postfix-start-stop" helper would be needed which
> is always running and only does dispatching of start/stop requests to
> the master(s) according to Postfix needs.
I was thinking the whole night how to solve it for upstart. I wrote a
python wrapper:
#############################################################
import os, sys
import time
program = "/usr/sbin/postfix"
# First start postfix and wait for the return code
try:
pid = os.fork()
except OSError, e:
Log.error("First fork failed")
print >>sys.stderr, ("Fork failed: (%d) %s" % (e.errno, e.strerror))
sys.exit(1)
if not pid:
try:
os.execvp(program, (program, "start"))
except OSError, e:
print >>sys.stderr, ("Exec failed: (%d) %s" % (e.errno,
e.strerror))
os._exit(1)
if os.wait()[1] != 0:
sys.exit(1)
# wait until we get killed
while True:
time.sleep(10)
#############################################################
This can be called with exec in upstart and doing a stop is easy, too,
because I simply call /usr/sbin/postfix stop in a post-stop script
block.
So if this is okay, I would use it. It is some kind of silly, but I
tested it here on my workstation and it does the job. But I also want to
ask the Ubuntu guys, if that is a working mechanism.
Thanks
Christian
--
Roessner-Network-Solutions
Bachelor of Science Informatik
Nahrungsberg 81, 35390 Gießen
F: +49 641 5879091, M: +49 176 93118939
USt-IdNr.: DE225643613
http://www.roessner-network-solutions.com