0

One can send SIGUSR2 to a running clamd instance to reload the signatures.

But how can I (from a script) determine, if the signatures have been reloaded? I can of course try "sleep 30" which will suffice in most cases (from my experience) but is there a script based approach apart from trying to parse the logfile?

Ralf Hildebrandt
  • 489
  • 1
  • 3
  • 12

1 Answers1

0

Found out:

#!/bin/bash
echo RELOAD | socat - /var/run/clamav/clamd.ctl
seconds=0
while : ; do
   output=`echo PING | socat - /var/run/clamav/clamd.ctl`
   if [ "$output" == "PONG" ]; then
      break
   fi
   sleep 1
   seconds=$[$seconds+1]
 done
 echo "reloaded after" $seconds "seconds"
Ralf Hildebrandt
  • 489
  • 1
  • 3
  • 12