• Install & Activate
  • Troubleshooting
BEST Antivirus KBS : Largest Anti-Malware Knowlegde Base and Support
  • Install & Activate
  • Troubleshooting

Schedule scans with Microsoft Defender for Endpoint (Linux)

/Download, Install & Active / Microsoft / Download, Install & Active / Microsoft / Microsoft Endpoint / Schedule scans with Microsoft Defender for Endpoint (Linux)
  • December 23, 2021
  • BEST Antivirus Staff 2
  • Microsoft / Microsoft Endpoint

Contents

  1. Pre-requisite
  2. To set the Cron job
    1. Backup crontab entries
      1. To inspect cron job runs
      2. To inspect the mdatp_cron_job.log*
  3. For those who use Ansible, Chef, or Puppet
    1. To set cron jobs in Ansible
    2. To set cron jobs in Puppet
  4. Additional information
    1. To get help with crontab
    2. To get a list of crontab file of the current user
    3. To get a list of crontab file of another user
    4. To backup crontab entries
    5. To restore crontab entries
    6. To edit the crontab and add a new job as a root user
    7. To edit the crontab and add a new job
    8. To edit other user’s crontab entries
    9. To remove all crontab entries
    10. To remove other user’s crontab entries
    11. Explanation
    12. Source : Official Microsoft Brand Editor by : BEST Antivirus KBS Team
0
(0)

Linux (and Unix) have a tool called crontab (similar to Task Scheduler) to be able to run scheduled tasks.

Pre-requisite

 Note

To get a list of all the time zones, run the following command: timedatectl list-timezones
Examples for timezones:

  • America/Los_Angeles
  • America/New_York
  • America/Chicago
  • America/Denver

To set the Cron job

Use the following commands:

Backup crontab entries

Bash

sudo crontab -l > /var/tmp/cron_backup_200919.dat

 Note

Where 200919 == YRMMDD

 Tip

Do this before you edit or remove.

To edit the crontab, and add a new job as a root user:

Bash

sudo crontab -e

 Note

The default editor is VIM.

You might see:

outbou

0 * * * * /etc/opt/microsoft/mdatp/logrorate.sh

Press “Insert”

Add the following entries:

Bash

CRON_TZ=America/Los_Angeles

0 2 * * sat /bin/mdatp scan quick > ~/mdatp_cron_job.log

 Note

In this example, we have set it to 00 minutes, 2 a.m. (hour in 24 hour format), any day of the month, any month, on Saturdays. Meaning it will run Saturdays at 2:00 a.m. Pacific (UTC -8).

Press “Esc”

Type “:wq” without the double quotes.

 Note

w == write, q == quit

To view your cron jobs, type sudo crontab -l

linux mdatp.

To inspect cron job runs

Bash

sudo grep mdatp /var/log/cron

To inspect the mdatp_cron_job.log*

Bash

sudo nano mdatp_cron_job.log

For those who use Ansible, Chef, or Puppet

Use the following commands:

To set cron jobs in Ansible

Bash

cron - Manage cron.d and crontab entries

See [https://docs.ansible.com/ansible/latest/modules/cron_module.html](https://docs.ansible.com/ansible/latest/modules/cron_module.html) for more information.

### To set crontabs in Chef

```bash
cron resource
```bash

See https://docs.chef.io/resources/cron/ for more information.

To set cron jobs in Puppet

Bash

Resource Type: cron

See https://puppet.com/docs/puppet/5.5/types/cron.html for more information.

Automating with Puppet: Cron jobs and scheduled tasks

See https://puppet.com/blog/automating-puppet-cron-jobs-and-scheduled-tasks/ for more information.

Additional information

To get help with crontab

Bash

man crontab

To get a list of crontab file of the current user

Bash

crontab -l

To get a list of crontab file of another user

Bash

crontab -u username -l

To backup crontab entries

Bash

crontab -l > /var/tmp/cron_backup.dat

 Tip

Do this before you edit or remove.

To restore crontab entries

Bash

crontab /var/tmp/cron_backup.dat

To edit the crontab and add a new job as a root user

Bash

sudo crontab -e

To edit the crontab and add a new job

Bash

crontab -e

To edit other user’s crontab entries

Bash

crontab -u username -e

To remove all crontab entries

Bash

crontab -r

To remove other user’s crontab entries

Bash

crontab -u username -r

Explanation

+—————- minute (values: 0 – 59) (special characters: , – * /)
| +————- hour (values: 0 – 23) (special characters: , – * /)
| | +———- day of month (values: 1 – 31) (special characters: , – * / L W C)
| | | +——- month (values: 1 – 12) (special characters: ,- * / )
| | | | +—- day of week (values: 0 – 6) (Sunday=0 or 7) (special characters: , – * / L W C)
| | | | |*****command to be executed

Source : Official Microsoft Brand
Editor by : BEST Antivirus KBS Team

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Tagged: MicrosoftMicrosoft for Endpoint

Related Articles

  • All about Microsoft

  • Overview of Microsoft 365 Lighthouse

  • Microsoft Defender for Business (preview) – Frequently asked questions and answers

  • Get help and support for Microsoft Defender for Business (preview)

  • Manage your custom rules for firewall policies in Microsoft Defender for Business (preview)

  • Firewall in Microsoft Defender for Business (preview)

ask or enter a search term

Top Rated Posts

5 (1)

Identity Protection – Enrolment/Registering (TotalAV)

5 (1)

All about Bitdefender Antivirus

5 (1)

Base Filtering Engine not found (Kaspersky)

5 (1)

[KB7857] Set up an HTTPS/SSL connection for ESET PROTECT (8.x) Linux

5 (1)

Installing on iPhone & iPad

About

We are BEST Antivirus , Trusted Comparison and Cheap Antivirus Software 2020. KBS is Knowledge Base and Support : This page was created to guide customers through the installation and to resolve all the common errors of anti-virus software.

Partners

› Avast
› AVG
› BitDefender
› ESET
› Trend Micro
› All Partners

Resources

› Store
› Advertise
› Brand Reviews
› Review Platforms
› Contact Page
› Knowledge Base

  • Install & Activate
  • Troubleshooting
© Copyright by BEST Antivirus by SSG Limited