FS#8565 - /etc/rc.d/postfix mutual conflict with Cyrus IMAPd
Attached to Project:
Arch Linux
Opened by Ryan Corder (rcorder) - Thursday, 08 November 2007, 06:02 GMT
Last edited by Hugo Doria (hdoria) - Tuesday, 29 July 2008, 17:00 GMT
Opened by Ryan Corder (rcorder) - Thursday, 08 November 2007, 06:02 GMT
Last edited by Hugo Doria (hdoria) - Tuesday, 29 July 2008, 17:00 GMT
|
Details
Description:
I maintain the Cyrus IMAP server package in AUR. Unfortunately, both Postfix and Cyrus IMAP both use a program named master as their main daemon. As a result, the 'pidof' program gets confused even though it shouldn't according to the pidof(8) man page. A simple fix would be for both rc scripts to use 'pgrep -f' instead of 'pidof'. For instance, change the line: PID=`pidof -o %PPID /usr/sbin/postfix/master` to the following: PID=`pgrep -f /usr/lib/postfix/master` And I have made the change in Cyrus IMAP's rc script from: PID=`pidof -o %PPID /usr/cyrus/bin/master` to the following: PID=`pgrep -f /usr/cyrus/bin/master` with these changes, both programs can live peacefully together and users will be happy. I have made the change and uploaded the new version to AUR as revision 3 of Cyrus IMAP 2.3.9 Additional info: * Postfix 2.4.6-1 * /etc/rc.d/postfix Steps to reproduce: If you install cyrus-imapd-2.3.9-2-i686.pkg.tar.gz from AUR, you will see how the two rc scripts conflict. If you start Postfix first, Cyrus IMAP will not start. If you start Cyrus IMAP first, Postfix will not start. |
This task depends upon
PID=`pidof -o %PPID /usr/sbin/postfix/master`
in /etc/rc.d/postfix is wrong. It should be
PID=`pidof -o %PPID /usr/lib/postfix/master`
otherwise stopping the daemon will fail. Maybe this resolves also the issue cited above?
When pidof is invoked with a full pathname to the program it should
find the pid of, it is reasonably safe. Otherwise it is possible that
it returns pids of running programs that happen to have the same name
as the program you're after but are actually other programs.
Unfortunately, if you change both the postfix and cyrus-master rc.d scripts back to using pidof, then whichever daemon you start second fails to start because pidof returns the PID of the other daemon's 'master' process and it thinks that it is already running.
I put that patch and a PKGBUILD on the AUR (http://aur.archlinux.org/packages.php?ID=16445).
This is pretty off-topic here, but maybe it might be a good idea to apply it to the sysvinit package on the core? Debian has several other patches for sysvinit that seem to do useful things, BTW (http://ftp.de.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.86.ds1-56.diff.gz). given my poor knowledge in this field I just didn't feel brave enough to try them out all - Who knows what they might do to my system? :-)
Any thoughts from the Postfix maintainer? I would be interested in hearing their thoughts on either pushing lupylucke's patch or switching the Postfix rc.d/ script to use pgrep.
Let me know if you find any problems related to this.