Backup of headless LE/thveadend on Rpi?

  • Sorry if this is a noob question. is it possible to do a LE backup, including the TVH setup, from an ssh command line? I know I can do it from inside Kodi, but the Rpi is in a small cupboard with no monitor nearby (it's used only as a TVH server). I really only care about TVH, but it doesn't seem to have a backup option that I can see.

    Failing any success here, I will power off and clone the SD card, but just wondering.

  • Code
    systemctl stop kodi.service
    tar -cvf mybackup.tar /storage/.kodi
    systemctl start kodi.service

    chewitt


    Sorry to bring this old thread up again, but i want to create a auto backup as well.


    I am new to Linux/LE and I got the cronjop working so far. But I have a question regarding stopping/starting the kodi service. Is this mandatory to get a consistent backup? I am asking, because the backup job seem to work properly as well while using Kodi+Tvheadend when backing up.


    thanks

  • Just stop kodi forever if it's running as server only ;) I have set it up this way :)

    Code
    This is my autostart.sh
    
    
    #!/bin/sh
    sleep 10;
    if systemctl stop wpa_supplicant kodi service.tigervnc docker.linuxserver.portainer pulseaudio; then
        echo "Services stoped"
    else
        echo "Error"
    fi

    Then I call another backupFull.sh script from cron to backup stuff every 24h ;)

    Bash
    #!/bin/sh
    tar -cpf /storage/backup/backup-$(date +%F).tar /storage/.config /storage/.kodi /storage/.ssh /storage/.ash_history /storage/.cache
  • Thank you for your advice Borygo77

    Server only doesn't work for me as both, kodi and Tvheadend run on my main HTPC.

    But backing up more than just .kodi makes sense.

    Maybe a stupid question:

    Does the restore function with LibreELEC do the job for the other folders as well (/storage/.config /storage/.ssh /storage/.ash_history /storage/.cache)?

    Currently my shell looks like this

    I am struggling with the find command as -exec needs another attribute, but I'm sure I will get that to work as well :)

    ...I might have to increase the the second sleep for the full backup...

    Thanks!

  • It does bub ๐Ÿ˜Š it will replace any file you have backed up with tar ๐Ÿ‘ what I found is Libreelec does need to have proper name of the file to restore it.

    20191124141244.tar this file will be restored alright but this one backup-2020-01-31.tar not ๐Ÿ™ˆ and I don't know why


    This is my delete script called from cron and it does the job for me alright ๐Ÿ˜‰

    Bash
    #!/bin/sh
    find /storage/zew/backup/auto_backup -mtime +4 -type f -delete

    It deletes any files and folders older than 4 days.

  • Hi All,

    I am still struggling with the automated backup.

    I wrote following scrip to execute with a cronjob.


    The script works 100% fine when I execute it manually (./autobackup.sh).

    It does not work properly when started via cron and I don't see why.

    When started via cron, all is executed properly except the rsync job.

    Does anyone have a clue?

    Thanks!!

  • My intension was having different backup states while doing full backups once a week.
    ... when using kodi under windows with dvbviewer, I had to fully restore kodi many (many) times.

    Thanks

  • rsync is part of the Network Tools but /storage/.kodi/addons/virtual.network-tools/bin is not part of the default (cron) PATH.

    Sourcing /etc/profile adds the addon paths to PATH.