This article describes an alternative way to automate platform backups. To configure the backup schedule through the platform interface, see the documentation article Creating platform backups.

Example


On the server with DCImanager 6:

  1. Create the script /root/dci_backup.sh:

    Script option with saving the backup to a local server

    #!/bin/bash
    yes "" | dci backup > backup.log 2>&1
    cat backup.log | awk -F'tar cfvz' '{print $2}' | egrep -o '[a-zA-Z0-9/_\.]+' | head -n1
    rm -f backup.log
    BASH

    Script option with saving the backup to a local and an external server

    #!/bin/bash
    backup=$(yes "" | dci backup > backup.log 2>&1;cat backup.log | awk -F'tar cfvz' '{print $2}' | egrep -o '[a-zA-Z0-9/_\.]+' | head -n1;rm -f backup.log)
    rsync $backup user@domain.com:/backups/
    BASH

    user — user name at the external server

    domain.com — domain name or IP address of the external server

    /backups/ — directory for backups on the external server

  2. Make the script executable:

    chmod +x /root/dci_backup.sh
    BASH
  3. Add the start of this script to cron:

    Example of daily script start at 02:15

    echo "15 2 * * * /root/dci_backup.sh" | crontab
    BASH
  4. Restart cron:

    systemctl restart crond
    BASH