Schedule an update of the Microsoft Defender for Endpoint (Linux)

Applies to:

  • Microsoft Defender for Endpoint Plan 2

To run an update on Microsoft Defender for Endpoint on Linux, see Deploy updates for Microsoft Defender for Endpoint on Linux.

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

Pre-requisite

Notation

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

Examples for timezones:

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

To prepare the Cron job

Use the following commands:

Fill-in crontab entries

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

Notation

Where 201118 == YYMMDD

Tip

Do this before yous edit or remove.

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

              sudo crontab -e                          

Note

The default editor is VIM.

You might see:

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

And

              02**saturday /bin/mdatp scan quick>~/mdatp_cron_job.log                          

See Schedule scans with Microsoft Defender for Endpoint (Linux)

Press "Insert"

Add together the following entries:

              CRON_TZ=America/Los_Angeles                          

#!RHEL and variants (CentOS and Oracle Linux)

                0 6 * * sunday [ $(date +%d) -le 15 ] && sudo yum update mdatp -y >> ~/mdatp_cron_job.log                              

#!SLES and variants

                0 6 * * sun [ $(date +%d) -le fifteen ] && sudo zypper update mdatp >> ~/mdatp_cron_job.log                              

#!Ubuntu and Debian systems

                0 six * * sun [ $(engagement +%d) -le fifteen ] && sudo apt-get install --only-upgrade mdatp >> ~/mdatp_cron_job.log                              

Note

In the examples above, we are setting it to 00 minutes, 6 a.m.(hour in 24 60 minutes format), any twenty-four hours of the calendar month, any month, on Sundays.[$(appointment +%d) -le 15] == Won't run unless it'southward equal or less than the 15th day (tertiary week). Significant it will run every tertiary Sundays(vii) of the month at 6:00 a.m. Pacific (UTC -8).

Press "Esc"

Type ":wq" w/o the double quotes.

Note

w == write, q == quit

To view your cron jobs, type sudo crontab -l

update Defender for Endpoint on Linux.

To inspect cron job runs:

              sudo grep mdatp /var/log/cron                          

To inspect the mdatp_cron_job.log

              sudo nano mdatp_cron_job.log                          

For those who use Ansible, Chef, or Puppet

Use the following commands:

To prepare cron jobs in Ansible

              cron - Manage cron.d and crontab entries                          

See https://docs.ansible.com/ansible/latest/modules/cron_module.html for more information.

To ready crontabs in Chef

              cron resource                          

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

To set cron jobs in Puppet

Resources Blazon: cron

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

Automating with Puppet: Cron jobs and scheduled tasks

See https://puppet.com/web log/automating-puppet-cron-jobs-and-scheduled-tasks/ for more data.

Additional information

To get assist with crontab

              man crontab                          

To go a list of crontab file of the electric current user

              crontab -l                          

To go a listing of crontab file of another user

              crontab -u username -l                          

To backup crontab entries

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

Tip

Do this before you lot edit or remove.

To restore crontab entries

              crontab /var/tmp/cron_backup.dat                          

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

              sudo crontab -east                          

To edit the crontab and add a new chore

              crontab -e                          

To edit other user'south crontab entries

              crontab -u username -east                          

To remove all crontab entries

              crontab -r                          

To remove other user's crontab entries

              crontab -u username -r                          

Explanation

+—————- infinitesimal (values: 0 - 59) (special characters: , - * /)              
| +————- hour (values: 0 - 23) (special characters: , - * /)
| | +———- day of calendar month (values: ane - 31) (special characters: , - * / L West C)
| | | +——- calendar month (values: one - 12) (special characters: ,- * / )
| | | | +—- 24-hour interval of week (values: 0 - 6) (Sun=0 or 7) (special characters: , - * / L W C)
| | | | |*****command to be executed