The clamd socket has to be deleted before starting via rc_subr.
Martin Matuska wrote: > The clamd socket has to be deleted before starting via rc_subr. Why?
Try the following: Start clamd via rc_subr startup script. Kill the process with -9 signal (may happen), the socket file is not deleted. Now try to start it again. The process is NOT started because of existing socket file.
martin@tradex.sk wrote: > Try the following: > > Start clamd via rc_subr startup script. Kill the process with -9 signal (may > happen), the socket file is not deleted. Now try to start it again. > The process is NOT started because of existing socket file. But then you already had a problem (clamd was terminated by sigkill), and you should have a hint to investigate. I would prefer: start_precmd=start_precmd start_precmd() { if [ -S "%%CLAMD_SOCKET%%" ]; then warn "Stale socket %%CLAMD_SOCKET%% removed." rm "%%CLAMD_SOCKET%% fi } or, even better: start_precmd=start_precmd start_precmd() { if [ -S "%%CLAMD_SOCKET%%" ]; then warn "Stale socket %%CLAMD_SOCKET%%, clamd may already be running." return 1 fi }
I agree to you proposal, the first version, here is a updated patch. But the best way would be existing pidfile and socket flags to clamd (there are no such flags). --- Makefile.orig Tue Sep 30 00:45:14 2003 +++ Makefile Tue Sep 30 02:02:48 2003 @@ -7,7 +7,7 @@ PORTNAME= clamav PORTVERSION= 0.60 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= security MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= clamav @@ -40,8 +40,11 @@ MAN5= clamav.conf.5 MAN8= clamd.8 +CLAMD_SOCKET?= /var/run/clamav/clamd + SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' \ - -e 's|%%DATADIR%%|${DATADIR}|g' + -e 's|%%DATADIR%%|${DATADIR}|g' \ + -e 's|%%CLAMD_SOCKET%%|${CLAMD_SOCKET}|g' SED_CONF= -E -e 's|^\#?(Example)$$|\#\1|' \ -e 's|^\#?(LogFile) .*$$|\1 /var/log/clamav/clamd.log|' \ --- files/clamd.sh.orig Tue Sep 30 23:33:16 2003 +++ files/clamd.sh Tue Sep 30 23:33:05 2003 @@ -26,6 +26,16 @@ required_dirs=%%DATADIR%% required_files=%%PREFIX%%/etc/clamav.conf +start_precmd=start_precmd + +start_precmd() +{ + if [ -S "$clamd_socket" ]; then + warn "Stale socket $clamd_socket removed." + rm "$clamd_socket" + fi +} + stop_postcmd=stop_postcmd stop_postcmd() @@ -37,6 +47,7 @@ clamd_enable=${clamd_enable:-"NO"} clamd_flags=${clamd_flags:-""} +clamd_socket=${clamd_socket:-"%%CLAMD_SOCKET%%"} load_rc_config $name run_rc_command "$1"
Responsible Changed From-To: freebsd-ports-bugs->dinoex I will take care of it.
State Changed From-To: open->feedback waiting for approval of mainatiner
State Changed From-To: feedback->closed committed after maintainter-timeout, thanks.