Mantis - exim
Viewing Issue Advanced Details
4988 packaging minor always 2012-08-02 23:37 2012-08-12 21:31
cwood  
bwalton  
normal  
assigned  
open  
none    
none  
0004988: missing exim pidfile
This is with:

/var/opt/csw/pkgutil/packages/exim-4.76,REV=2012.05.07-SunOS5.9-i386-CSW.pkg

The start clause in /var/opt/csw/svc/method/svc-cswexim reads (excerpts):


DAEMON=/opt/csw/sbin/exim
PIDFILE=/var/run/exim.pid

test -z "$EXIM_PARAMS" && EXIM_PARAMS="-bd -q30m"

case "$1" in
  start)
    echo "Starting MTA: \c"
    $DAEMON $EXIM_PARAMS
    echo "exim."
    ;;


This borks svcadm for disable and restart, as found in /var/svc/log/network-cswexim:default.log:

[ Aug 2 17:10:59 Stopping because service disabled. ]
[ Aug 2 17:10:59 Executing stop method ("/var/opt/csw/svc/method/svc-cswexim stop"). ]
Stopping MTA: cat: cannot open /var/run/exim.pid: No such file or directory
Usage: kill [-l] [-n signum] [-s signame] job ...
   Or: kill [ options ] -l [arg ...]


Because stop etc. need to read the pidfile:

  stop)
    echo "Stopping MTA: \c"
    kill `cat "$PIDFILE"`
    echo "exim."
      ;;


To fix this, please have exim write a pid file.

In /var/opt/csw/svc/method/svc-cswexim:

test -z "$EXIM_PARAMS" && EXIM_PARAMS="-bd -oP ${PIDFILE} -q30m"

In /etc/opt/csw/exim/exim-env.sh:

EXIM_PARAMS="-bd -oP /var/run/exim.pid -q30m"
As a workaround, if I create /etc/opt/csw/exim/exim-env.sh before installing CSWexim and give it this line:

EXIM_PARAMS="-bd -oP /var/run/exim.pid -q30m"

Then exim starts without any issues, and /var/run/exim.pid is written. Disable and restart act normally through svcadm.

As background, I will be managing this thing through puppet, so will need to restart exim whenever a config file changes.

Thank you for your OpenCSW packaging work, this is altogether very useful.
related to 0004952closed bwalton svc refresh bug 
Issue History
2012-08-02 23:37 cwood New Issue
2012-08-04 15:46 bwalton Note Added: 0010078
2012-08-04 15:46 bwalton Assigned To => bwalton
2012-08-04 15:46 bwalton Status new => assigned
2012-08-04 16:29 bwalton Relationship added related to 0004952
2012-08-04 16:30 bwalton Note Added: 0010079
2012-08-05 00:49 cwood Note Added: 0010082
2012-08-12 16:11 cwood Note Added: 0010086
2012-08-12 21:31 bwalton Note Added: 0010087

Notes
(0010078)
bwalton   
2012-08-04 15:46   
Confirmed. I'm actually going to modify build options to set the default PID file instead of relying on the start environment options. Using -oP will allow overriding though if environments prefer a different location.

The new packages are just about ready and will also include changes to avoid fiddling with /usr/lib/sendmail, etc...are you able to test these when I post them to experimental?

Thanks
-Ben
(0010079)
bwalton   
2012-08-04 16:30   
Packages that address this issue are available for testing here: http://buildfarm.opencsw.org/experimental.html#exim [^]

Feedback welcomed. As mentioned previously, this release no longer relies on fiddling with /usr/lib/sendmail.

Thanks
-Ben
(0010082)
cwood   
2012-08-05 00:49   
I will test when I'm back close to my Solaris host, thank you.
(0010086)
cwood   
2012-08-12 16:11   
My apologies for the delay.

I installed this:

http://buildfarm.opencsw.org/experimental/exim/exim-4.80,REV=2012.08.04-SunOS5.10-i386-CSW.pkg.gz [^]

I found that it correctly creates a pid file on exim installation and "svcadm enable network/cswexim".

One caveat is that the experimental package doesn't remove /var/run/exim.pid when I run "svcadm disable network/cswexim". This can be a problem with software like monit, where it may check for a running process using the pid from the pidfile, and run the start script if the process doesn't exist.

(Obviously Solaris has SMF, but you never know what people may decide to install.)
(0010087)
bwalton   
2012-08-12 21:31   
Thanks for testing this. I've just committed a fix that will see the pid file removed to avoid issues like those you mention.

I also noticed that my updated build used /var/opt/csw/log/ as the path for log files instead of /var/opt/csw/log/exim/ and this was causing the package to go into a maintenance state on my test system.

Updated experimental packages have been added to the same location. They're dated 2012.08.12. I'll test them on my systems too, but I'd appreciate your feedback as well.

Thanks
-Ben