あーかいぶすハイディフィニション

ここはもう更新しとらんのじゃ

Freshclam の rc スクリプト

ClamAV 0.97.4/14872 で確認。
./configure --prefix=/usr/local でインストールして、pid ファイル設置先を /var/run/clamav/ として設定した場合、RHEL 系なら以下のスクリプトで動くはずです。configtest は、freshclam にないっぽいから諦めた。

#!/bin/sh
#
# Freshclam.
#
# chkconfig:   - 85 15 
# description:  Freshclam is update virus databases for clamav;
# processname: freshclam
# config:      /usr/local/etc/freshclam.conf
# pidfile:     /var/run/clamav/freshclam.pid
 
# Source function library.
. /etc/rc.d/init.d/functions

freshclam="/usr/local/bin/freshclam"
prog=$(basename $freshclam)

FRESHCLAM_CONF_FILE="/usr/local/etc/freshclam.conf"

lockfile=/var/lock/subsys/freshclam

start() {
    [ -x $freshclam ] || exit 5
    [ -f $FRESHCLAM_CONF_FILE ] || exit 6
    echo -n $"Starting $prog: "
    daemon $freshclam -d --config-file=$FRESHCLAM_CONF_FILE
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}
 
stop() {
    echo -n $"Stopping $prog: "
    killproc $prog -QUIT
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}
 
restart() {
    stop
    sleep 1
    start
}

rh_status() {
    status $prog
}
rh_status_q() {
    rh_status >/dev/null 2>&1
}

case "$1" in
    start)
        rh_status_q && exit 0
        $1
        ;;
    stop)
        rh_status_q || exit 0
        $1
        ;;
    restart|configtest)
        $1
        ;;
    status)
        rh_status
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|}"
        exit 2
esac