Skip to content

Commit 15426a5

Browse files
authored
Merge pull request #3262 from denisebmsft/docs-editor/schedule-antivirus-scan-anacro-1742836731
Update schedule-antivirus-scan-anacron.md
2 parents 54206e0 + 797b057 commit 15426a5

File tree

1 file changed

+35
-24
lines changed

1 file changed

+35
-24
lines changed

defender-endpoint/schedule-antivirus-scan-anacron.md

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: Schedule an antivirus scan using Anacron in Microsoft Defender for Endpoint on Linux
2+
title: Schedule an antivirus scan using Anacron with Microsoft Defender for Endpoint on Linux
33
description: Learn how to schedule an antivirus scan in Microsoft Defender for Endpoint on Linux for better protection of your organization's assets.
44
ms.service: defender-endpoint
55
ms.author: deniseb
66
author: denisebmsft
77
ms.localizationpriority: medium
8-
ms.date: 12/02/2023
8+
ms.date: 03/24/2025
99
manager: deniseb
1010
audience: ITPro
1111
ms.collection:
@@ -17,18 +17,15 @@ ms.subservice: linux
1717
search.appverid: met150
1818
---
1919

20-
# Schedule an antivirus scan using Anacron in Microsoft Defender for Endpoint on Linux
20+
# Schedule an antivirus scan using Anacron with Microsoft Defender for Endpoint on Linux
2121

2222
**Applies to:**
2323

2424
- Microsoft Defender for Endpoint for servers
2525
- Microsoft Defender for Servers Plan 1 or Plan 2
2626
- Microsoft Defender Antivirus
2727

28-
To run a scan of Microsoft Defender Antivirus for Linux, see [Supported Commands](linux-resources.md#supported-commands).
29-
30-
> [!NOTE]
31-
> This article supports Microsoft Defender for Endpoint on Linux for Red Hat Enterprise Linux distributions (RHEL).
28+
To run a scan of Microsoft Defender Antivirus for Linux, see [Supported commands](linux-resources.md#supported-commands).
3229

3330
## System requirements
3431

@@ -37,23 +34,27 @@ See the following system requirements needed to schedule Microsoft Defender Anti
3734
- Linux distributions and versions: Red Hat Enterprise Linux 7.2 or higher.
3835
- The **FANOTIFY** option in kernel must be enabled.
3936

37+
Also see [Prerequisites for Microsoft Defender for Endpoint on Linux](mde-linux-prerequisites.md).
38+
4039
## Scheduling Microsoft Defender Antivirus scan in Red Hat Linux
4140

42-
You can schedule cron jobs to initiate Microsoft Defender Antivirus scans on a schedule. For more information, see [How to schedule scans with Microsoft Defender for Endpoint on Linux](schedule-antivirus-scan-crontab.md). This process works well if the device is always up and running.
41+
You can [schedule cron jobs to initiate Microsoft Defender Antivirus scans on a schedule](schedule-antivirus-scan-crontab.md). This process works well if the device is always up and running.
4342

44-
But if the Linux devices are shut down or offline during the cron schedule, the scan won't run. In these situations, you can use **anacron** to read the timestamp and find the last executed job. If the device was shut down during the scheduled cron job, it needs to wait until the next scheduled time. By using **anacron**, the system will detect the last time the scan was run. If the device didn't run the cron job, it will automatically start it.
43+
But if the Linux devices are shut down or offline during the cron schedule, scans don't run. In these situations, you can use **anacron** to read the timestamp and find the last executed job. If the device was shut down during the scheduled cron job, it needs to wait until the next scheduled time. By using **anacron**, the system will detect the last time the scan was run. If the device didn't run the cron job, it will automatically start it.
4544

4645
### Schedule Microsoft Defender Antivirus scans in Red Hat Linux
4746

4847
Use the following steps to schedule scans:
4948

5049
1. Connect to the RedHat server using PuTTY.
51-
1. Edit the anacron file:
50+
51+
2. Edit the anacron file as follows:
52+
5253
```shell
5354
vi /etc/anacron
5455
```
5556

56-
1. :::image type="content" source="media/vi-etc-anacron.png" alt-text="Sample Anacron Job Linux." lightbox="media/vi-etc-anacron.png" link="media/vi-etc-anacron.png":::
57+
3. Review and edit your Anacron file, which contains the following information:
5758

5859
```shell
5960
# /etc/anacrontab: configuration file for anacron
@@ -66,19 +67,24 @@ Use the following steps to schedule scans:
6667
# delay will be 5 minutes + RANDOM_DELAY for cron.daily
6768
```
6869

69-
1. Note the following items in the file.
70-
1. **Shell:** Shell is referred as `/bin/sh`, and not as `/bin/bash`. Remember when writing the jobs.
71-
1. **RANDOM_DELAY:** Describes the maximum time in minutes for the job. This value is used to offset the jobs so there wouldn't be too many jobs running at the same time. Using this delay is ideal for VDI solutions.
72-
1. **START_HOURS_RANGE:** Describes the time range to run the job.
73-
1. **cron.daily:** Describes 1 as the period of days required for the frequency of job executions. 5 is the delay in minutes that anacron waits after the device restarts.
70+
Notice the following items in the file:
71+
72+
- **Shell** is referred as `/bin/sh`, and not as `/bin/bash`. Remember this when you're configuring jobs.
73+
- **RANDOM_DELAY** describes the maximum time in minutes for the job. This value is used to offset the jobs so there aren't too many jobs running at the same time. Using this delay is ideal for VDI solutions.
74+
- **START_HOURS_RANGE** describes the time range to run the job.
75+
- **cron.daily** describes `1` as the period of days required for the frequency of job executions. `5 is the delay in minutes that anacron waits after the device restarts.
7476

75-
1. Review look at the anacron jobs:
77+
4. Review your anacron jobs by using the following command:
7678

7779
```shell
7880
ls -lh /etc/cron*
7981
```
8082

81-
:::image type="content" source="media/vi-etc-anacron.png" alt-text="Sample Anacron Job Linux." lightbox="media/vi-etc-anacron.png" link="media/vi-etc-anacron.png":::
83+
You should see information similar to what's shown in the following screenshot:
84+
85+
:::image type="content" source="media/vi-etc-anacron.png" alt-text="Sample Anacron Job Linux." lightbox="media/vi-etc-anacron.png" link="media/vi-etc-anacron.png":::
86+
87+
The following code example provides a more detailed view:
8288

8389
```shell
8490
[root@redhat7 /] # ls -lh /etc/cron*
@@ -117,9 +123,9 @@ Use the following steps to schedule scans:
117123
total 0
118124
```
119125

120-
1. Ignore the `/etc/cron.d` directory, you will see `/etc/cron.daily, hourly, monthly, and weekly`.
126+
Ignore the `/etc/cron.d` directory; instead, review `/etc/cron.daily, hourly, monthly, and weekly`.
121127

122-
1. To schedule a weekly antivirus scan, you can create a file (Job) under the ```/etc/cron.weekly``` directory.
128+
5. To schedule a weekly antivirus scan, you can create a file (Job) under the ```/etc/cron.weekly``` directory.
123129

124130
```shell
125131
cd /etc/cron.weekly
@@ -145,7 +151,7 @@ Use the following steps to schedule scans:
145151
Type: wq!
146152
```
147153

148-
1. Change the file permissions to allow the file to be executed.
154+
6. Change the file permissions to allow the file to be executed by using this command:
149155

150156
```shell
151157
Chmod 755 mdavfullscan
@@ -168,13 +174,13 @@ Use the following steps to schedule scans:
168174
[root@redhat7 cron.weekly] #
169175
```
170176

171-
1. Use the command to test the weekly anacron job.
177+
7. Use the following command to test the weekly anacron job:
172178

173179
```shell
174180
./mdavfullscan
175181
```
176182

177-
1. Use the command to verify the job ran successfully.
183+
8. Use the following command to verify the job ran successfully:
178184

179185
```shell
180186
cat /logs/mdav_avacron_full_scan.log
@@ -192,5 +198,10 @@ Use the following steps to schedule scans:
192198
[root@redhat7 cron.weekly] #
193199
```
194200

195-
[!INCLUDE [Microsoft Defender for Endpoint Tech Community](../includes/defender-mde-techcommunity.md)]
201+
## See also
196202

203+
- [Microsoft Defender for Endpoint on Linux](microsoft-defender-endpoint-linux.md)
204+
- [Prerequisites for Microsoft Defender for Endpoint on Linux](mde-linux-prerequisites.md)
205+
- [Configure security settings and policies for Microsoft Defender for Endpoint on Linux](linux-preferences.md)
206+
207+
[!INCLUDE [Microsoft Defender for Endpoint Tech Community](../includes/defender-mde-techcommunity.md)]

0 commit comments

Comments
 (0)