Backup to Yandex Disk

    This script backup directories /etc/astra and file /usr/bin/astra to Yandex.Disk service

    Create a script

    TAR="$(which tar)"
    GZIP="$(which gzip)"
    NOW=$(date +%Y%m%d)
    mkdir /tmp/backuptmp
    mkdir /tmp/backuptmp/$NOW
    $TAR -cf /tmp/backuptmp/$NOW/etc_astra.tar /etc/astra
    $TAR -cf /tmp/backuptmp/$NOW/astra_bin.tar /usr/bin/astra
    cd /tmp/backuptmp
    curl --user -T $DUMPFILE ""
    rm -rf /tmp/backuptmp/*
    • - Your e-mail address (login)
    • password - your password

    Save this script as in the directory /opt
    Create a directory backup in Yandex Disk

    Configure cron (Linux task scheduler)

    open the editor with the command

    sudo crontab -u root -e

    and in the opened file add a line:

    40 2 * * * sh /opt/ > /dev/null

    do not forget to put at the end of the line Enter (line break!)

    Save the file. Now at 2 hours 40 minutes (at night) you will have a backup of Astra in your Yandex Disk in the backup directory with the current date.