Bitdefender
Support Center

Scheduled system-wide scans with BDC



For setting up scheduled system scans you will need BDC and Cron. BDC is the Bitdefender Command Line Scanner which will be used for scanning the system and is included in all Bitdefender for Linux/FreBSD Mail/File Servers products (/opt/Bitdefender/lib/bdc for Linux, and /usr/local/bitdefender/lib/bdc for FreeBSD). You can also use the standalone version, which can be downloaded from here(for Linux) or here(for FreeBSD 4.x) or here(for FreeBSD 5.x). Cron is the system daemon which will manage the scheduled scan tasks, and is installed by default on most systems. You will also have to use bdc-cron.sh, a shell script that will help you manage the CronJobs. You must save this script somewhere on the system, for example in your home directory. Please note that all the commands from this article are ran from the directory where you saved the script.


ADD BDC SCAN CRONJOBS

To add a BDC Scan Cron job you must run the command :

#./bdc-cron.sh --add

You will first be asked for the BDC path, the default answer is a path which is automatically determined, and if it's the correct one you can just press enter.

> Enter BDC Scan CronJob settings

BDC path [/opt/bdc/bdc] :

Next you must enter the path to the file or folder which you want to be scanned. This must be a valid path. The default value is '/', so if you want to scan the entire system just press enter.

Path to be scanned [/] :

You can set the BDC scan options at the next prompt. The default value is for BDC to scan archives, mails, to list all scanned files, to move infected and suspected files in to the quarantine, you can press enter to accept these options :

Scan options [--files --arc --mail --list --move --moves] :

You can find out all valid BDC options in it's manpage :

#man bdc

or :

#bdc --help

The next step is to configure the time and date when the scan job should be run. Cron decides when to run a job based on five fields : Minute, Hour, Day of Month, Month and Day of Week. Jobs are executed by Cron when the Minute, Hour, and Month of Year fields match the current time, and at least one of the two day fields (Day of month, or Day of Week) match the current time. These are the valid Cron fields values :

Minute0-59
Hour0-23
Day of Month1-31
Month1-12
Day of Week0-7

A field may be an asterisk *, which always stands for first-last, or any value.

Ranges of numbers are allowed, ranges are two numbers separated with a hyphen, the specified range is inclusive. For example, 8-11 for the Minute field specifies execution at minutes 8, 9, 10 and 11.

Lists are allowed, a list is a set of numbers (or ranges) separated by commas. Examples: 1,2,5,9, 0-4,8-12

Step values can be used in conjunction with ranges. Following a range with /<number> specifies skips of the number's value through the range. For example, 0-23/2 can be used in the Hour field to specify command execution every other hour (an alternative/equivalent for 0-23/2 is 0,2,4,6,8,10,12,14,16,18,20,22).

Steps are also permitted after an asterisk, so if you want to say "every two hours", just use */2 in the Hour field. If you want to schedule a job "every 30 minutes" you can use */30 in the Minute field.

The bdc-cron.sh script will ask for each of these fields. The deafult values configure the job to be executed at 00:00 (midnight) every day :

> Enter BDC CronJob time settings

Minutes value [0] :
Hour value [0] :
Day of Month value [*] :
Month value [*] :
Day of Week value [*] :

If there will be an error while adding this new job, the error message will give you the exact filed that had an incorrect value.

Each job has two parts, the time and date settings, and the command to be run. You can setup a cronjob manually by running :

#crontab -e

which will open the default system editor. You can then add a line as this one :

0 0 * * * /opt/bdc/bdc --files --arc --mail --list --move --moves /

which will add the same job bdc-cron.sh adds by default. The first five fields are the same as the time and date fields described above. The rest of the line is the command which must be ran. More information on manually configuring Cron jobs ca be found in Cron manpages :

#man cron
#man crontab
#man 5 crontab

LIST BDC SCAN CRONJOBS

For showing all BDC Scan ConJobs you must run the command :

# ./bdc-cron.sh --list

The output will be similar tho this one :

> BDC Scan CronJob ID 0 :

0 0 * * * /opt/bdc/bdc --files --arc --mail --list --move --moves /

> BDC Scan CronJob ID 1 :

30 */3 * * * /opt/bdc/bdc --files --arc --mail --disinfect /home

When added each job will get an unique ID, which you can later use to edit that job's settings.


EDIT BDC SCAN CRONJOBS

You can edit a BDC Scan CronJob by running :

#./bdc-cron.sh --edit

First you will have to provide the ID of the job you want to edit :

> Enter the BDC CronJob ID

CronJob ID :

and after that enter the new settings :

> Enter BDC Scan CronJob settings

BDC path [/opt/bdc/bdc] :
Path to be scanned [/] :
Scan options [ --files --arc --mail --list --move --moves ] :

> Enter BDC CronJob time settings

Minutes value [0] :
Hour value [0] :
Day of Month value [*] :
Month value [*] :
Day of Week value [*] :

The default values are the same ones you used when the job was added, you can enter a new value for the fields you want to edit, and press enter for the ones you don't want to be changed. If by mistake you enter a incorrect field value the job will not be modified and the error mesage will indicate the incorrect field.


DELETE BDC SCAN CRONJOBS

Any BDC Scan CronJob can be deleted by running :

# ./bdc-cron.sh --delete

You will only have to enter the ID of the job you want to delete :

> Enter the BDC CronJob ID

CronJob ID :

ADD THE BDC UPDATE CRONJOB

You if you are using the standalone BDC, not the one from Bitdefender for Linux/FreBSD Mail/File Servers products, you should also configure the Update CronJob. That can be done by running :

#./bdc-cron.sh --update --add

You will be asked for the BDC path and the time settings, just as with a Scan ConJob :

> Enter BDC Update CronJob settings

BDC path [/opt/bdc/bdc] :

> Enter BDC CronJob time settings

Minutes value [0] :
Hour value [*/3] :
Day of Month value [*] :
Month value [*] :
Day of Week value [*] :

By default this Update CronJob will be executed once every there hours, but you can enter any other values.


LIST THE BDC UPDATE CRONJOB

To view the BDC Update CronJob you can run the command :

# ./bdc-cron.sh --update --list

The output will be similar to this :

> BDC Update CronJob :

0 */3 * * * /opt/bdc/bdc --update

EDIT THE BDC UPDATE CRONJOB

The BDC Update CronJob can be edited by running :

# ./bdc-cron.sh --update --edit

which will ask you for new settings for the update job :

> Enter BDC Update CronJob settings

BDC path [/opt/bdc/bdc] :

> Enter BDC CronJob time settings

Minutes value [0] :
Hour value [*/3] :
Day of Month value [*] :
Month value [*] :
Day of Week value [*] :

The default values are the same you used when the job was added, you can enter a new value for the field you want to edit, and press enter for the ones you don't.


DELETE THE BDC UPDATE CRONJOB

The BDC Update CronJob can be deleted by running :

# ./bdc-cron.sh --update --delete



Applies to: Bitdefender Security for Samba

Operating Systems: Fedora, FreeBSD, Mandrake, Red Hat, Slackware, SUSE