Package: clamav-milter
Version: 0.96.3+dfsg-2~volatile1
We have recently experienced the case that clamav-milter was 'running' but the
socket file was missing. This caused our mail
system (postfix) to reject mail with a temporary error.
Monitoring the service by checking the return code from
'/etc/init.d/clamav-milter status' did not catch this situation.
I have updated the 'status' check to include a check for the sockets existence
and an alternate error code (LSB correct, I
believe). See attached patch.
The patch also fixes the call to 'status_of_proc' with the variable $BASENAME
in place of $NAME (which does not exist).
It also moves the 'local' copy of the function 'status_of_proc' below the
sourcing of '/lib/lsb/init-functions' so that this
version of the function gets called. Before, this local copy of the function
was just unused code in the init script. This local
copy of the LSB function now checks the existence of the clamav-milter socket
as defined in '$SOCKET_PATH'.
Regards
Chris
--- /etc/init.d/clamav-milter 2010-09-23 13:42:48.000000000 +0200
+++ /tmp/clamav-milter 2010-10-21 10:21:00.892392574 +0200
@@ -23,35 +23,6 @@
[ -x "$DAEMON" ] || exit 0
-status_of_proc () {
- local pidfile daemon name status
-
- pidfile=
- OPTIND=1
- while getopts p: opt ; do
- case "$opt" in
- p) pidfile="$OPTARG";;
- esac
- done
- shift $(($OPTIND - 1))
-
- if [ -n "$pidfile" ]; then
- pidfile="-p $pidfile"
- fi
- daemon="$1"
- name="$2"
-
- status="0"
- pidofproc $pidfile $daemon >/dev/null || status="$?"
- if [ "$status" = 0 ]; then
- log_success_msg "$name is running"
- return 0
- else
- log_failure_msg "$name is not running"
- return $status
- fi
-}
-
to_lower()
{
word="$1"
@@ -276,6 +247,38 @@
SOCKET="$MilterSocket"
fi
+status_of_proc () {
+ local pidfile daemon name status
+
+ pidfile=
+ OPTIND=1
+ while getopts p: opt ; do
+ case "$opt" in
+ p) pidfile="$OPTARG";;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ if [ -n "$pidfile" ]; then
+ pidfile="-p $pidfile"
+ fi
+ daemon="$1"
+ name="$2"
+
+ status="0"
+ pidofproc $pidfile $daemon >/dev/null || status="$?"
+ if ( [ "$status" = 0 ] && [ -S $SOCKET_PATH ] ); then
+ log_success_msg "$name is running"
+ return 0
+ elif ( [ "$status" = 0 ] && [ ! -S $SOCKET_PATH ] ); then
+ log_failure_msg "$name socket missing"
+ return 4
+ else
+ log_failure_msg "$name is not running"
+ return $status
+ fi
+}
+
wait_for_socket()
{
local socket; socket="$1"
@@ -431,7 +434,7 @@
$0 start
;;
status)
- status_of_proc "$DAEMON" "$NAME"
+ status_of_proc "$DAEMON" "$BASENAME"
exit $?
;;
*)
_______________________________________________
Pkg-clamav-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-clamav-devel