Changeset View
Changeset View
Standalone View
Standalone View
security/clamav/files/clamav-clamd.in
Show All 17 Lines | |||||
name=clamav_clamd | name=clamav_clamd | ||||
rcvar=clamav_clamd_enable | rcvar=clamav_clamd_enable | ||||
# read settings, set default values | # read settings, set default values | ||||
load_rc_config "$name" | load_rc_config "$name" | ||||
: ${clamav_clamd_enable:=NO} | : ${clamav_clamd_enable:=NO} | ||||
: ${clamav_clamd_socket="%%CLAMAV_CLAMD_SOCKET%%"} | |||||
: ${clamav_clamd_pidfile="%%CLAMAV_CLAMD_PIDFILE%%"} | : ${clamav_clamd_pidfile="%%CLAMAV_CLAMD_PIDFILE%%"} | ||||
: ${clamav_clamd_user="%%CLAMAVUSER%%"} | |||||
command=%%PREFIX%%/sbin/clamd | command=%%PREFIX%%/sbin/clamd | ||||
pidfile=${clamav_clamd_pidfile} | |||||
required_dirs=%%DBDIR%% | required_dirs=%%DBDIR%% | ||||
required_files=%%PREFIX%%/etc/clamd.conf | required_files=%%PREFIX%%/etc/clamd.conf | ||||
start_precmd=clamav_clamd_precmd | start_precmd=clamav_clamd_precmd | ||||
extra_commands=reload | extra_commands=reload | ||||
reload_cmd="%%PREFIX%%/bin/clamdscan --reload" | reload_cmd="%%PREFIX%%/bin/clamdscan --reload" | ||||
#clamav .93 won't start without a valid main.c[vl]d file | #clamav .93 won't start without a valid main.c[vl]d file | ||||
clamav_clamd_precmd() | clamav_clamd_precmd() | ||||
{ | { | ||||
local rundir=${clamav_clamd_pidfile%/*} | |||||
if [ ! -d $rundir ] ; then | |||||
install -d -m 0755 -o ${clamav_clamd_user} -g ${clamav_clamd_user} $rundir | |||||
fi | |||||
if [ ! -f %%DBDIR%%/main.cvd -a ! -f %%DBDIR%%/main.cld ];then | if [ ! -f %%DBDIR%%/main.cvd -a ! -f %%DBDIR%%/main.cld ];then | ||||
echo "Missing %%DBDIR%%/*.cvd or *.cld files. You must run freshclam first" | echo "Missing %%DBDIR%%/*.cvd or *.cld files. You must run freshclam first" | ||||
exit 1 | exit 1 | ||||
fi | fi | ||||
} | } | ||||
run_rc_command "$1" | run_rc_command "$1" |