Scheduled Scan

You can configure Dr.Web to perform a background scan at scheduled times. The scanning will begin automatically, triggered by an agent or a daemon.

To configure a scheduled scan

1.Create an property list file (.plist) named com.drweb.scheduled.plist. In this file, the following keys can be used:

 

Key description

Key

Description

Example

Label

Job name.

Type: a string.

The value should be com.drweb.scheduled.

The required key.

 

ProgramArguments

Launch arguments that specify which directories to scan.

Type: a string array.

The first string is an executable path, the value should be /usr/local/bin/drweb-ctl;

the second string contains a command to launch a scan of a specified directory, the value should be scan;

the third string contains a path to a directory to scan.

The required key.

Launching the /Users directory scan:

<key>ProgramArguments</key>

   <array>

       <string>/usr/local/bin/drweb-ctl</string>

       <string>scan</string>

       <string>/Users</string>

   </array>

StartCalendarInterval

Launch calendar interval.

Type: a dictionary of integers.

The optional key.

Launching the scan at 1:30 every day:

<key>StartCalendarInterval</key>

   <dict>

       <key>Hour</key>

       <integer>1</integer>

       <key>Minute</key>

       <integer>30</integer>

   </dict>

StartInterval

Launch interval.

Type: an integer.

The optional key.

Launching the scan every 3600 seconds.

<key>StartInterval</key>

   <integer>3600</integer>

StandardOutPath

File that should be used for data being sent to stdout.

Type: a string.

The optional key.

Scan result output to the /Users/i.ivanov/Documents/drweb_out.log directory:

<key>StandardOutPath</key>

   <string>/Users/i.ivanov/Documents/drweb_out.log</string>

 

Property list file examples

Example 1. Configure the /Users directory scan that is run every day at 1:30:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"

 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

   <key>Label</key>

   <string>com.drweb.scheduled</string>

   <key>ProgramArguments</key>

   <array>

        <string>/usr/local/bin/drweb-ctl</string>

        <string>scan</string>

        <string>/Users</string>

   </array>

   <key>StartCalendarInterval</key>

   <dict>

       <key>Hour</key>

       <integer>1</integer>

       <key>Minute</key>

       <integer>30</integer>

   </dict>

</dict>

</plist>

Example 2. Configure the /Users directory scan that is run every 3600 seconds (1 hour) and output the results to the /Users/<UserName>/Documents/drweb_out.log file:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"

 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

   <key>Label</key>

   <string>com.drweb.scheduled</string>

   <key>ProgramArguments</key>

   <array>

       <string>/usr/local/bin/drweb-ctl</string>

       <string>scan</string>

       <string>/Users</string>

   </array>

   <key>StartInterval</key>

   <integer>3600</integer>

</dict>

</plist>

2.Place a created file to the one of the following directories:

/Library/LaunchDaemons is a directory of system daemons launched with the root privileges.

/Library/LaunchAgents is a directory of agents launched for all users.

~/Library/LaunchAgents is a directory of agents only launched for a current user.

3.Open Terminal and run the following commands:

sudo chown root:wheel <path>/com.drweb.scheduled.plist
sudo chmod 755 <path>/com.drweb.scheduled.plist
launchctl bootstrap gui\$(id -u) <path>/com.drweb.scheduled.plist

As an example, you should run the following command sequence for a daemon:

sudo chown root:wheel /Library/LaunchDaemons/com.drweb.scheduled.plist
sudo chmod 755 /Library/LaunchDaemons/com.drweb.scheduled.plist
launchctl bootstrap gui/$(id -u) /Library/LaunchDaemons/com.drweb.scheduled.plist

For more information about creating daemons and agents, please see Apple programming guide hyper_link.