SIRIS, ALTO, and NAS: Creating an auto-update script for the Datto Linux Agent

Follow

Topic

This article describes the process of creating a script that will automatically update your Datto Linux Agent (DLA). Follow this workflow on each of your protected Linux servers to keep the Linux agent certificate on the protected endpoint up-to-date.

Environment

  • Datto Linux Agent

Description

Prerequisites

This article assumes you have basic knowledge of the Linux command line and have root-level access to your Linux system via a command-line interface. For assistance with creating an auto-update script for the Datto Linux Agent, contact your Linux System Administrator.

Script creation

The Datto Linux Agent installs updates through the Linux distribution's package management system, rather than through a DLA command, so each distribution type will need a slightly different command to perform the update. You can put these commands into a script that is called by a cron job (external link). The cron job will automatically run the update script each day.

Use the following steps to create a script.

  1. Create the script file (all distros).
    You can create the script in whatever directory you would like to keep it in. For this example, we will use root's home directory, but you can replace the path to suit your own installation needs.
    ~/dla_update.sh
    chmod +x ~/dla_update.sh
  2. Enter the script file contents.
    Cut and paste the appropriate block into the ~/dla_update.shfile you just created.

    For Debian/Ubuntu systems

    #!/bin/bash
    apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 370C85D709D26407
    bash -c "echo 'deb [arch=amd64] https://cpkg.datto.com/datto-deb/public/$(lsb_release -sc) $(lsb_release -sc) main' > /etc/apt/sources.list.d/datto-linux-agent.list"
    apt-get update
    apt-get install dlad

    For Red Hat/CentOS systems

    #!/bin/bash
    yum update dlad

    For OpenSUSE/SLE systems

    #!/bin/bash
    zypper install dlad

    For Fedora systems

    #!/bin/bash
    dnf install dlad

Cron job creation (all distros)

To create the cron job that will run the script, follow the steps below.

1. Run the following command as root.

crontab -e

2. Add the line below to create a cron job that will run the update every day at midnight.

0 0 * * * ~/dla_update.sh

3. Save and exit the editor.

4. You can view the new crontab file to confirm that the new job is in place by running: 

crontab -l

Service restart

To activate the new cron job, restart the cron service according to your Linux distribution's init system type. To determine your init system type, check the documentation for your specific Linux distribution.

Example:

/etc/init.d/cron restart

or

service cron restart

or

systemctl restart crond.service

Additional Resources

 


Was this article helpful?

0 out of 2 found this helpful

You must sign in before voting on this article.

Want to talk about it? Have a feature request?

Head on over to our Datto Community Forum or the Datto Community Online.

For more Business Management resources, see the Datto RMM Online Help and the Autotask PSA Online Help .

Still have questions? Get live help.

Datto Homepage