Commit 75dbe04 1 parent c43c0de commit 75dbe04 Copy full SHA for 75dbe04
File tree 3 files changed +86
-19
lines changed
3 files changed +86
-19
lines changed Original file line number Diff line number Diff line change @@ -12,16 +12,34 @@ if ! [ -z $HTTPProxyPort ]; then echo "HTTPProxyPort $HTTPProxyPort" >> /etc/c
12
12
DB_DIR=$( sed -n ' s/^DatabaseDirectory\s\(.*\)\s*$/\1/p' /etc/clamav/freshclam.conf )
13
13
DB_DIR=${DB_DIR:- ' /var/lib/clamav' }
14
14
MAIN_FILE=" $DB_DIR /main.cvd"
15
- echo " [bootstrap] Checking for Clam DB in $MAIN_FILE "
16
15
17
- if [ ! -f ${MAIN_FILE} ]; then
18
- echo " [bootstrap] Initial clam DB download."
19
- /usr/bin/freshclam
20
- fi
16
+ function clam_start () {
17
+ if [[ ! -e /var/run/clamav/created ]]
18
+ then
19
+ touch /var/run/clamav/created
20
+ fi
21
+ freshclam -d &
22
+ echo -e " waiting for clam to update..."
23
+ until [[ -e ${MAIN_FILE} ]]
24
+ do
25
+ :
26
+ done
27
+ echo -e " starting clamd..."
28
+ clamd &
29
+ }
21
30
22
- # start clam service itself and the updater in background as daemon
23
- freshclam -d &
24
- clamd &
31
+ if [[ ! -z " ${CLAM_DELAY} " ]]
32
+ then
33
+ if [[ ! -z " ${DELAY_CREATE_ONLY} " && -e /var/run/clamav/created ]]
34
+ then
35
+ clam_start
36
+ else
37
+ echo -e " waiting for ${CLAM_DELAY} before starting clamav..."
38
+ sleep ${CLAM_DELAY} && clam_start
39
+ fi
40
+ else
41
+ clam_start
42
+ fi
25
43
26
44
# recognize PIDs
27
45
pidlist=$( jobs -p)
Original file line number Diff line number Diff line change @@ -12,16 +12,34 @@ if ! [ -z $HTTPProxyPort ]; then echo "HTTPProxyPort $HTTPProxyPort" >> /etc/c
12
12
DB_DIR=$( sed -n ' s/^DatabaseDirectory\s\(.*\)\s*$/\1/p' /etc/clamav/freshclam.conf )
13
13
DB_DIR=${DB_DIR:- ' /var/lib/clamav' }
14
14
MAIN_FILE=" $DB_DIR /main.cvd"
15
- echo " [bootstrap] Checking for Clam DB in $MAIN_FILE "
16
15
17
- if [ ! -f ${MAIN_FILE} ]; then
18
- echo " [bootstrap] Initial clam DB download."
19
- /usr/bin/freshclam
20
- fi
16
+ function clam_start () {
17
+ if [[ ! -e /var/run/clamav/created ]]
18
+ then
19
+ touch /var/run/clamav/created
20
+ fi
21
+ freshclam -d &
22
+ echo -e " waiting for clam to update..."
23
+ until [[ -e ${MAIN_FILE} ]]
24
+ do
25
+ :
26
+ done
27
+ echo -e " starting clamd..."
28
+ clamd &
29
+ }
21
30
22
- # start clam service itself and the updater in background as daemon
23
- freshclam -d &
24
- clamd &
31
+ if [[ ! -z " ${CLAM_DELAY} " ]]
32
+ then
33
+ if [[ ! -z " ${DELAY_CREATE_ONLY} " && -e /var/run/clamav/created ]]
34
+ then
35
+ clam_start
36
+ else
37
+ echo -e " waiting for ${CLAM_DELAY} before starting clamav..."
38
+ sleep ${CLAM_DELAY} && clam_start
39
+ fi
40
+ else
41
+ clam_start
42
+ fi
25
43
26
44
# recognize PIDs
27
45
pidlist=$( jobs -p)
Original file line number Diff line number Diff line change 6
6
# configure freshclam.conf and clamd.conf from env variables if present
7
7
source /envconfig.sh
8
8
9
- # start clam service itself and the updater in background as daemon
10
- freshclam -d &
11
- clamd &
9
+ if ! [ -z $HTTPProxyServer ]; then echo " HTTPProxyServer $HTTPProxyServer " >> /etc/clamav/freshclam.conf; fi && \
10
+ if ! [ -z $HTTPProxyPort ]; then echo " HTTPProxyPort $HTTPProxyPort " >> /etc/clamav/freshclam.conf; fi && \
11
+
12
+ DB_DIR=$( sed -n ' s/^DatabaseDirectory\s\(.*\)\s*$/\1/p' /etc/clamav/freshclam.conf )
13
+ DB_DIR=${DB_DIR:- ' /var/lib/clamav' }
14
+ MAIN_FILE=" $DB_DIR /main.cvd"
15
+
16
+ function clam_start () {
17
+ if [[ ! -e /var/run/clamav/created ]]
18
+ then
19
+ touch /var/run/clamav/created
20
+ fi
21
+ freshclam -d &
22
+ echo -e " waiting for clam to update..."
23
+ until [[ -e ${MAIN_FILE} ]]
24
+ do
25
+ :
26
+ done
27
+ echo -e " starting clamd..."
28
+ clamd &
29
+ }
30
+
31
+ if [[ ! -z " ${CLAM_DELAY} " ]]
32
+ then
33
+ if [[ ! -z " ${DELAY_CREATE_ONLY} " && -e /var/run/clamav/created ]]
34
+ then
35
+ clam_start
36
+ else
37
+ echo -e " waiting for ${CLAM_DELAY} before starting clamav..."
38
+ sleep ${CLAM_DELAY} && clam_start
39
+ fi
40
+ else
41
+ clam_start
42
+ fi
12
43
13
44
# recognize PIDs
14
45
pidlist=$( jobs -p)
You can’t perform that action at this time.
0 commit comments