Hi all,

I have recently seen on this list that Matt Gourly has had problems getting clamd to start correctly under daemontools and log to the specified directory.

The following has been tested (by me) to work on a RedHat 7.3 installation:

/etc/clamd.conf:
--BEGIN--
LogFile /dev/stderr
LocalSocket /tmp/clamd
FixStaleSocket
User qscand
Foreground
ScanOLE2
ScanMail
ScanHTML
ScanArchive
--END--

Fix Permissions:
$ mkdir -p /var/log/clamd
$ chown qscand:qscand /var/log/clamd

/service/clamd/run:
--BEGIN--
#!/bin/sh
# --------------------------------------------------
# run
#
# Purpose - Start the clamd daemon/service.
# # Author - Jesse D. Guardiani
# Created - 09/10/03
# Modified - 11/09/04 by Jorge Valdes
# --------------------------------------------------
# This script is designed to be run under DJB's
# daemontools package.
# # ChangeLog
# ---------
#
# 09/25/03 - JDG
# --------------
# - Changed clamd user to qscand in compliance with
# the change to qmail-scanner-1.20rc3
#
# 09/10/03 - JDG
# --------------
# - Created
# --------------------------------------------------
# Copyright (C) 2003 WingNET Internet Services
# Contact: Jesse D. Guardiani (jesse at wingnet dot net)
# --------------------------------------------------


# Location of clamd lock file
lockfile="/tmp/clamd.lock"

# Location of the clamd binary
path_to_clamd="/usr/local/sbin/clamd"

# Location of the clamd config file
path_to_config="/etc/clamd.conf"

# The exit code we use to announce that something bad has happened
BAD_EXIT_CODE=1

# The following pipeline is designed to return the pid of each
# clamd process currently running.
get_clam_pids_pipeline=`ps ax | grep -E "${path_to_clamd}\$" | grep -v grep | awk '{print $1}'`


# --------------------------------------------------
# Generic helper functions
# --------------------------------------------------

# Basic return code error message function
die_rcode() {
       EXIT_CODE=$1
       ERROR_MSG=$2

       if [ $EXIT_CODE -ne '0' ]; then
               echo "$ERROR_MSG"
               echo "Exiting!"
               exit "$BAD_EXIT_CODE"
       fi
}

# --------------------------------------------------
# Main
# --------------------------------------------------

ps_clamd=""
ps_clamd="$get_clam_pids_pipeline"

if [ -n "$ps_clamd" ]; then
       pid_count="0"
       for pid in $ps_clamd
       do
               pid_count=`expr $pid_count + 1`
       done

die_rcode $BAD_EXIT_CODE "Error: $pid_count clamd process(es) already running!"

fi

if [ -e "$lockfile" ]; then
       rm "$lockfile"
       exit_code="$?"
       die_rcode $exit_code "Error: 'rm $lockfile' call failed."
fi

exec /usr/local/bin/softlimit 35000000\
$path_to_clamd  -c $path_to_config 2>&1
--END--

/service/clamd/log/run:
--BEGIN--
#!/bin/sh
exec /usr/local/bin/setuidgid qscand\
/usr/local/bin/multilog t s1024000 n10 /var/log/clamd
--END--

Hope this helps...

--
Jorge Valdes
Intercom El Salvador
[EMAIL PROTECTED]
voz: ++(503) 278-5068
fax: ++(503) 265-7025

_______________________________________________
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-users

Reply via email to