Automatic backup

I don’t want daily, where I wrote it? I’d set about weekly.

Anything can happen, like me despite the SD was ok… some glitch of the HW SW communication did.

Everyone doesn’t need that till something happens :slight_smile:

@relkai I’ve needed that already, don’t want to wait to need it again and pray :slight_smile:

It’s your decision, I’m grateful for everything but I bet there is a demand for it and it’s very easy for you just to set location, frequency in hours and time to schedule for the frequency, nothing more super needed :slight_smile: A script has already been provided here.

And it can be pretty pointless to backup on the CE SD card if anything happens so the SD usage is not important.

You keep saying, how urgently you need it, but you don‘t answer any questions (see the posts from TheCoolest and me).
You can restore from a quite old backup (several months) without loosing anything.

If you really want a scheduled backup, you don‘t really need an integrated solution or a whole script, but a simple tar command and a single entry in your crontab.
The tar command needed has already been covered several times:

It‘s no rocket science and I expect everyone to be able to implement it.

2 Likes

Yes if its so important then a very simple crontab would offer the functionality and is within the capability of anyone to implement. I did a similar thing when my library autoscrapper stopped working - I built my own simple script and crontab to do the same thing.

Shoog

Couldn’t this be done just as well via an add-on? In which case it doesn’t need to be left to the team to do, anyone with the skills and motivation can chip in.
I wouldn’t have thought many people would have a use for it, but that’s probably true of most add-ons - we pick and choose what we want.

1 Like

Sure, creating an addon with this functionality would be possible. If someone has the motivation and the knowledge to do it, it could be installed into CE.

2 Likes

I thought it’s obvious that any database changes every day (watched status etc), even some plugins change over time.

but thx for the script
would be useful a script just to put inside “/storage/.config/udev.rules.d” and the magic can be done

If you’ve no time to backup many times, then you purpously leave yourself wide open to problems, and really have no justification for asking the devs to save you from your own laziness

and you never forget anything in your life so no need to automate anything in such a simple life in the jungle, right? :slight_smile:

The only thing I am possibly misunderstanding is why you somehow insist that LibreELEC and CoreELEC are the same. They are not (or they would have the same name, obviously).

With that out of the way, whether including an automatic backup for CoreELEC (since this forum is about CoreELEC) would make the software better or not is a matter of opinion, you think it would, I (for one) think it wouldn’t. So the only thing to do is raise a request ( as I have done for you) and see if the devs agree to it. :thinking:

C‘mon guys, let‘s not point the finger at each other and just try to stay on topic.

1 Like

To start an automatic backup 2 minutes after booting CE (courtesy of gregeeh :grinning:) :

  1. Put this code to /storage/.kodi/userdata/backup.sh, the last 5 backups are saved:

#!/bin/bash
#Purpose = Backup Kodi

#define your backup-directory
DESTDIR=/var/media/USB_4TB_25/kodi-backup/leia/

cd $DESTDIR

#number of backups, which exists after script has finished = NUM+1
#5 backups to be saved
NUM=4

ls -1tr $DESTDIR/*.tar | head -n -$NUM | xargs rm

TIME=`date +%Y%m%d%H%M%S` # date in backup name.
FILENAME=$TIME.tar # Backup Name
SRCDIR=“/storage/.kodi/ /storage/.cache /storage/.config/”

tar cvf $DESTDIR/$FILENAME $SRCDIR

You have to modify the line which defines DESTDIR to fit your needs.

  1. Put this lines to /storage/.config/autostart.sh:

#Backup starts 2 minutes after booting
(sleep 120; /storage/.kodi/userdata/backup.sh >& /storage/.kodi/userdata/backup.sh.log)&

Hope that helps somebody…

1 Like

Just a comment, every time I do a manual backup to the backup folder, the next backup, backs up that tar file as well, so future backups will get larger & larger.

That’s because it’s part of the /storage partition, too.
I agree with you, that this should be excluded by the backup function, but on the other hand it’s a bad idea to use the default /storage/backup path anyway, because it is lost, when your sd card crashes.
You should change the deafult path to a network location or an attached usb hdd instead.

1 Like

I do realize (honest) that coreelec isn’t libreelec, but why the change in the backup function?
In libreelec backup copies (I think) .config, .cache, .kodi and .ssh.
That’s always been enough for me.

1 Like

Please edit your code to below or no date will be shown in your backup .tar

TIME=`date +%Y%m%d%H%M%S`            # Date in Backup Name.
FILENAME=$TIME.tar    # Backup Name

The confusion probably arises from this . . .

Good to hear that you have found a solution :smile:
@trogggy, CoreELEC backups include .config, .cache and .kodi. I personally haven’t had any issue with that (so far). Is .ssh actually a necessary part of a backup?

/storage/backup is already excluded by the backup function. Only .kodi, .cache and .config (under /storage) are included. Or has that changed?

@bubblegum57 have you changed the default backup location?

TIME=`date +%Y%m%d%H%M%S`

TIME=`date +%d%m%Y%H%`

TIME=`date +%d%m%Y`

Played around with this and thought i would share.

You are right. I edited my previous post to clarify.

I use the default location then copy to my pc. Extra work I know